During my week in Geneve, i rewrote most of the treecode to use ultrafast billboards w/ a new light source-dependent leaf shader. Hard work, but worth it. Result: trees look more realistic:
Normal Mapping & Holiday
I just returned home from a 5-day holiday to Bergen, so I really needed a thorough coding session. The previous weeks have mostly been filled with administrative stuff such as beer, phd defenses, socializing and various other anomalies. I therefore decided that today was the day to finally implement a really needed feature: Normal Mapping.
I have added another intrinsic shading class to the CiRIOBase framework, class CBumpMapping inherits CShaderParent and contains everything needed for setting up tangential spaces and other stuff.
Below is a tree with a procedurally generated texture + normal map
The main information used in the normal mapping shader is based on, well, a normal map of the procedurally generated heightmap. A new CTextureMachine command named “CreateNormalMap” does the trick, and such a map is depicted below:
The normal map supports ambient, diffuse and specular lightning. These textures are just to “show off” the CTextureMachine and CBumpShader capabilities, realistic trees do not look shine like plastic =)
However, I will post more screenshots when I have developed newer and better trunk textures.
Posted in Uncategorized | No Comments »
First official CiRIO shader & extra stuff
After the success of implementing impostors, I decided to do something else for a while. The recent couple of days I have therefore:
- Implemented a CiRIO Shader framework based on a CiRIO CShaderParent parent class
- Implemented a blur and toon kernel-based edge-detection shader, enabling various combinations of adding blur effects / edge effects in the CiRIO framework
- Implemented a particle class for morphing/viewing/manipulating large arrays of vertices
- Performed several major / minor fixes, updates and improvements.
A quick example on how to use the shader for rendering “toon” scenes:
CToonAndTreeShader ScreenShader; ScreenShader.Initialize("screen", TOON2, 0.2, CVector(1,1,1), 1024.0);
Here, “screen” is the shader ID, TOON2 is one of the available toon modes, 0.2 is the particular parameter for this toon mode, the vector is RGB color scaling and 1024 is the width of the blur/toon effect. In order to use the shader, include the following after your scene has been rendered:
ScreenShader.ScreenToTexture(); ScreenShader.Render();
An example of pure edge detection:
Posted in Uncategorized | No Comments »
Damn those Impostors
After 8 hours of agonizing pain, I finished implementing a code for including tree impostors. Instead of rendering high-poly trees at far-away distances, it is now possible to pre-render the tree to a texture and then rendering the whole tree using a single polygon. The net effect? CiRIOTree can now add about 5 times as many trees at the same framerate – with only a fraction of lower detaile levels.
The image below shows how small the visual difference is between a true tree and an impostor
In the following picture, 4 000 textureless unique cacti are generated. Most of the tree seen here are now impostors, drastically improving performance (runs at about 30fps on my apple macbook)
Below are some new screenshots with impostors active. All textures are generated with the CiRIO framework.
Posted in Uncategorized | 1 Comment »
Random leaf textures
During the course of today’s work, I have done three important tasks:
- I have restructured the whole CiRIO framework, making way for the (upcoming) CiRIOGUI library
- I have implemented loads of smaller features, fixing bugs and improving overall structure
- I have completed the tools needed for generating leaf textures, as depicted below
The picture below shows a random generated leaf texture.
The TextureMachine code for generating this texture is :
Initialize 3 128 GenerateDiamondMap 1 Bump 1 -1 0.3 -1 0.005 -1 -0.9 Circle 0 1 3000 4.0 Normalize 0 1 Normalize 1 1 Merge 0 1 1.0 1 RGBNormalize 0 2.0 ToBitMap 0 0.6 1.0 0.5 1.0 CreateTransparentTexture leaf 220 RenderLeaves 500 leaf tree1_leaf 20 10
An image of various procedural trees generated with procedural trunk and leaf textures is depicted below. Please note that these trees are different realizations of the same tree template type.
with a closeup shot of the leaf texture here
Posted in Uncategorized | Comments Off
Polly is Dead, Long Live CiRIO
Two and a half years ago, I started developing a hobby-based 3D engine called Polly. Polly was my sandbox, my little playground where I would gradually learn how to implement various 3D-engine features such as real-time physics, quad & octatrees, object oriented world repositories, structured OOP design, resource management, OpenGL shaders, simple AI and various algorithms and data structures.
Unfortunately, I might have aimed for Polly to be more than it was. A huge sandbox. It was therefore very hard to finish anything, as the whole project grew out of technical interests without any focus on implementing user interfaces, documentation nor having an overall goal. Every time I had motivation & some spare time, I would start implementing something new in this eventually large project, without knowing where i would end up. And so time flew.
Development came to a halt when I entered my final year of my thesis. Things froze, and I shifted my focus elsewhere.
In June 2010, I finished my PhD thesis. I finished half a year in advance, and will get paid by my university until december 2010. During these six months, I will have ample time to try to actually complete a project, this time more reasonable than Polly.
Projects:
- Extracting the basic parts of Polly, rewriting code and and providing a simple and elegant easy-to-use OpenGL library in C++. This library will contain all the “basic” functions for future libraries. This is the CiRIO base library.
- Providing a simple and powerful library for procedurally generating fauna: trees, ferns, grass, fungi, in addition to procedurally generating the textures. This is the CiRIOTree framework.
The earlier “Polly” framework is therefore now like a old shipwreck, where I am constantly removing parts and recycling them into new, stand-alone libraries. Instead of having one huge project to complete, I therefore believe it will be possible to actually getting things done, focusing on one library at the time.
Since I finished my PhD about a week ago, I have already implemented a preliminary CiRIO base framework together with a procedural tree generator. Some screenshots are presented here, where the only three properties that distinguish the trees from each others are a) position b) tree type and c) the random seed.
In the next couple of months, I will try to build up a development blog for people who are interested in either using the CiRIO framework or interested in the algorithms that I have used. I will be focusing on both the production of procedurally generated objects, code design and CiRIO code tutorials.
Polly is dead, long live CiRIO
Posted in Uncategorized | No Comments »
