Dark Bit Factory & Gravity

GENERAL => Projects => Topic started by: Stonemonkey on May 17, 2007

Title: software rendering using SSE
Post by: Stonemonkey on May 17, 2007
Here's an exe and the source for something I did quite a while ago, I'm sorry about the state of the source. It's my first attempt at normal mapping and also has some sort of depth of field thing going on. It needs a fairly decent cpu with sse.
Title: Re: software rendering using SSE
Post by: rain_storm on May 17, 2007
Is that bump mapping I see on the cubes? and looks as though they are blurred slightly with distance. Thanks very much for including the source code. Cant wait to see how you did the water
Title: Re: software rendering using SSE
Post by: Stonemonkey on May 17, 2007
Yep, it's all normal mapped and there's depth of field which means that only objects at a particular distance are in focus, anything further away or closer goes out of focus.
The water was done by creating a random normal map which was smoothed out several times and then scrolled over the mesh which is just a load of tris with random heights for the verts (the mesh doesn't change at all and the texture is all one colour).
Title: Re: software rendering using SSE
Post by: ninogenio on May 17, 2007
thank you fryer!!!

that really is lovely, im at a stage where i need stuff like this to learn new effects and how there done.
although its a little choppy on the fps it is hugely fast for what it is doing.

k+
Title: Re: software rendering using SSE
Post by: Paul on May 17, 2007
very cool k+
Title: Re: software rendering using SSE
Post by: taj on May 17, 2007
So texture mapping (mipmaps I guess), intersecting 3d, epth of field, bump mapping, phong lighting. In software?

OK K++.

That was cool.
Title: Re: software rendering using SSE
Post by: Shockwave on May 18, 2007
Yep, it's software rendered alright! Looks neat, very nice.. Very very nice indeed.
Title: Re: software rendering using SSE
Post by: Stonemonkey on May 18, 2007
There's something I've thought about now and again related to this and it's possibly something like relief mapping or something but I'm not really sure.
When doing the normal mapping, the light and camera vectors from each vertex are tranformed into texture space and then interpolated across each triangle so for each pixel I have a position on the texture map and a vector to the camera as well as having a height (although the heightmap isn't used during rendering atm) so I've been thinking it might be possible to use something like voxels or something to produce a pixel offset on the texture map to give more realistic bumpmapping.

Anyone else got any thoughts on that or anyone with some experience with voxels?
Title: Re: software rendering using SSE
Post by: taj on May 18, 2007
Stonemonkey,

I dont know about voxels but what you could do is something like:

assuming you have u,v texture coords

normalise (eyevec) <- v important to take care of z component of eye
height = heightTexture(u,v)
u= h * u * fudgefactor
v= h * v * fudgefactor

Fudgefactor is some arbitrarily small number that looks good. That would be parallax mapping. I dont know aboput relief mapping equations.

Chris
Title: Re: software rendering using SSE
Post by: Stonemonkey on May 18, 2007
Thanks taj, I'm not really sure how that would work atm though.
Title: Re: software rendering using SSE
Post by: taj on May 20, 2007
Thanks taj, I'm not really sure how that would work atm though.

Oh yeah sorry you are right it should be

Code: [Select]
u= u +u*( h-MAXHEIGHT/2.0) * fudgefactor
v= v +v*( h-MAXHEIGHT/2.0) * fudgefactor

Where maxheight represents the heighest possible value in your height field (1.0 maybe or 255).
If its still unclear try looking up parallax mapping.

I'm coding this from memory so please forgive mistakes.

Chris
Title: Re: software rendering using SSE
Post by: Stonemonkey on May 20, 2007
Cheers taj, I see it now. I think that would work ok as long as the surface isn't too lumpy.
Title: Re: software rendering using SSE
Post by: taj on May 20, 2007
Yes Im not sure of it yet as Ive yet to work it out, but I think it does have artefacts. Nontheless, damn cheap ISNT IT! I'll try it out in shaders I think.
Title: Re: software rendering using SSE
Post by: Stonemonkey on May 20, 2007
shouldn't it be something like:
Code: [Select]
u= u +cam_vx*( h-MAXHEIGHT/2.0) * fudgefactor
v= v +cam_vy*( h-MAXHEIGHT/2.0) * fudgefactor

where cam_vx,cam_vy are the x and y components of the normalised camera vector in texture space?
Title: Re: software rendering using SSE
Post by: taj on May 20, 2007
yes, yes I think thats right...did I get it wrong again?