Author Topic: software rendering using SSE  (Read 6922 times)

0 Members and 1 Guest are viewing this topic.

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
software rendering using SSE
« 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.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: software rendering using SSE
« Reply #1 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

Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: software rendering using SSE
« Reply #2 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).

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: software rendering using SSE
« Reply #3 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+
Challenge Trophies Won:

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: software rendering using SSE
« Reply #4 on: May 17, 2007 »
very cool k+
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: software rendering using SSE
« Reply #5 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.
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: software rendering using SSE
« Reply #6 on: May 18, 2007 »
Yep, it's software rendered alright! Looks neat, very nice.. Very very nice indeed.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: software rendering using SSE
« Reply #7 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?

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: software rendering using SSE
« Reply #8 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
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: software rendering using SSE
« Reply #9 on: May 18, 2007 »
Thanks taj, I'm not really sure how that would work atm though.

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: software rendering using SSE
« Reply #10 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
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: software rendering using SSE
« Reply #11 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.

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: software rendering using SSE
« Reply #12 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.
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: software rendering using SSE
« Reply #13 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?

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: software rendering using SSE
« Reply #14 on: May 20, 2007 »
yes, yes I think thats right...did I get it wrong again?
Challenge Trophies Won: