maandag 3 november 2008

XML

i'm thinking of converting my data formats to XML, while i'm not an advocate of such a format( to bloated) it is certainly usefull. My scenegraph is mostly contained of nodes, which have their global attributes, like the transformation matrix, number of childs they reference, it suits perfectly in an xml based style for parsing, also the data i depend on heavily relies on big file sets, and we generally want to only have one set floating around on the medium. so instead of storing files locally it should be better to store file references, i havent' studied a lot of xml, but it's format is almost the same as mine..counting parentheses, and parse the data inside the current frame. Something more important, i've ported almost everything to the new code base, and added occlusion queries, combined with the octree-based structure it should give a HUGE speed up( the paper is covered in detail in gpu gems2)

paul

dinsdag 12 augustus 2008

OpenGL 3.0


Today i've read the opengl 3.0 specs, it was a little bit dissapointing,and that is big understatement, opengl 3.0 has been in development for how many years now?! It was even delayed for another year to clean up the mess that opengl has become. but back to reality today they published it, but it are just some new extensions that got approved by the ARB, nothing of the OO type of thing that was promised, functions are called deprecrated now, but since they want backwards compatibility everything of the old GL is still included. I'm wondering if ATI/AMD are going to update their drivers to the new specs.

update: found a comparision picture of the opengl drivers :)




Paul

woensdag 9 juli 2008

Shader Editor


I started the other night creating a shader editor, because editing the material files by hand, is a tedious job, everything has to be spelled correctly, otherwise textures won't load, fragment programs won't run etc. etc.

On the upper-right there is going to be a realtime preview. there are 3 tabs the most obvious ones on this pic are the vertex & fragment shader, the texture panel is going to be an openGLCanvas where all supported textures can be dropped on so one could choose what kind of texture it is, as well as setting it's properties, of that texture stage, rotation, scaling etc. When pressed 'ok' a new Material file will be generated and added to the list. Which is much nicer, than editing everything by hand, I wanted to start integrating the entity handling events this week, but i will first finish this.

Paul

vrijdag 4 juli 2008

omni lights


WOW:)
Omni lights are working now,

The biggest problem was that i didnt set up the correct(modelview) matrices for the cubemap, i just 'debugged' the code by drawing the 6 frusta of the omni.
What i am doing now is rendering the squared distances of the light into an floating point cubemap, which i use in turn in the shadow shader to see if the fragment is in shadow or not.
here is the fragment shader, needs to be cleaned up still:

uniform sampler2D tex0; //diffusetex
uniform sampler2D tex1; //normaltex
uniform sampler2D tex2; //depth texture
uniform samplerCube tex3; //shadow tex
uniform vec3 lightPos; //light pos
uniform vec3 lightColor; //light color
uniform float lightRadius; //raidus
uniform mat4 invMat; //inv projmv mat
varying vec3 camPos; //camera position
varying vec2 texCoord;
varying vec4 dir;
uniform float lightScale;


void main()
{
vec4 base = texture2D(tex0, texCoord);
vec3 bump = normalize(texture2D(tex1, texCoord).xyz* 2.0 - 1.0);
float depth = texture2D(tex2, texCoord).r;
vec4 worldPos = invMat * vec4( (texCoord*2.0)-1.0, depth * 2.0 - 1.0, 1.0 );
worldPos.xyz /=worldPos.w;
vec3 lDir =(lightPos - worldPos.xyz);
float distanceSqr = dot(lDir, lDir);
float distance = sqrt(distanceSqr);
float att=max(0.0, 1.0 - distance/lightRadius)*lightScale;
lDir = normalize(lDir);
float shadow = textureCube(tex3, -lDir).r;
float shadowColor = ((distanceSqr)>shadow) ? 1.0 : 0.0;
float diff = max(0.0, dot(lDir, bump));
vec4 final_color = vec4(0.0, 0.0, 0.0, 0.0);
if(diff > 0.0)
{
final_color += base * diff * att * vec4(lightColor, 1.0)*lightScale;
}
//vec4 color =
gl_FragColor = final_color*shadowColor;
}

zaterdag 28 juni 2008

What the fuck


just trying to run some test on the engine, suddenly i get this:0
probably a big bug somewhere
Paul

dinsdag 27 mei 2008

virtual cube maps


here are 2 pics of rendering to an unrolled depth cube map, just RGB for now, because depth cube maps are recently supported on geforce 8x hardware, it is unrolled for now, in a standard texture

Paul

woensdag 21 mei 2008

screenshots..



...last blog comment sofar.. i will post more if i got more convincing screenshots..this are more of the same kind..





zondag 18 mei 2008

code changes

I've rewritten certain parts of the code, mainly 'alWorld.cpp', alShadowmap.cpp, and alCamera.cpp.
before alWorld had 2 arraylists, containing both deferred and forward shaded polys. I've moved this variables to the alCamera.h so every camera has it's own set of visible polygons..much more easier to maintain. Since i can query frustum calls directly from the camera class.
plus it is easier to create special effects like mirrors, portals.
I hope to implement shadowmapping today.


void alWorld::doShadowPass(alLight* light)
{
//setup matrices for this light
if(light->setupMatrices())
{
alShadowMap *map = light->getShadowMap();
//render to FBO(depth only)
map->begin();
alCamera * cam = map->getCamera();
//get intersecting polys
fillPolys(cam);
//fill depth buffer
zOnlyPass(cam);
//end fbo
map->end();
//wxLogMessage(_T("NumPolys is %d"), cam->getDeferredPolys()->size());
}
}

zaterdag 10 mei 2008

some thoughts..


i did some research..mostly reading white papers about deferred shading, mostly about setting up the g-buffer..but most of the papers stated that it is difficult..to do transparancy. But i don't see the big deal, i first render all deferred geometry, than do the lighting pass, (yes lightning is limited). Then switch to forward shading, and can all do of nice stuff. Right now i've set the limit to the 8 hardware openGL lights. Which i think is enough, for surfaces that really need to be highlighted, we can get some really nice effects.

Next big thing is integrating physics, i've set up the basic framework already, every material can have its special properties, mass, material, specific gravity. I'm going to integrate bullet physics
(http://www.bulletphysics.com/Bullet/wordpress/) they did a great job..i'm impressed especially by their softbody physics.

Paul

dinsdag 6 mei 2008

test




test.. with some model..textures are wrong, as well as the winding of the polygons...


update..added a simple water shader..basically took the old (Forward rendering ) code and rewrote it a bitt

maandag 5 mei 2008

SSAO



implemented screen space ambient occlusion, still need some tweaking though

zondag 30 maart 2008

deferred shading






finally implemented deferred shading, as for now, i only see benefits of using it, of course it has it drawbacks, like not handling transparancy, but well having 500 lights realtime, unoptimized, with all the eye candy is worth it.