Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shaders under OSX
02-26-2008, 09:28 PM,
Feel free to really dig into the shaders and clean them up. Those shaders were some of the first I ever wrote, so I 1) didn't pay attention to optimization, just coding ease and 2) as I tried different things, I comment out a lot of broken code / wrong ideas and never bothered to remove them.

On your first screenshot, the reason it looks like there's no gloss map is because everything is always in shadow (no specular gets applied when in shadow). So, that's where the real problem is -- something to do with the shadow map lookup.

Also, the reason I had a loop for just 2 iterations was because adding more loops allows for more cascades of the shadow map (so you can get shadows rendered further and further away)... but I left it at 2 due to performance reasons. Still, it's fine if you unroll it.

The brake lights are turned off for other objects by selecting the texture unit and doing:
On windows and linux this makes it so that texture lookups inside the shader yield all zeros. If it doesn't do that on Mac then we should pass in a uniform to the shader instead.

EDIT: I wrote this post this morning but forgot to hit submit. I see you already figured out the brake light thing. The graphics.cpp should be modified to pass in a float uniform for the self illumination, and then the shader should multiply the self illumination texture lookup result by that uniform float. It wouldn't take me very long to make this change but if you want the challenge I can leave it to you.

The VDrift graphics pipeline is self contained to graphics.cpp (which makes some calls to shader.cpp to deal with shaders). The game.cpp file just calls GRAPHICS::BeginScene(), GRAPHICS:Big GrinrawScene(), and GRAPHICS::EndScene(). You should be able to track through those functions and get the gist of it. Basically, if some other object wants to draw something it registers a drawable with the scenegraph and sets that up. The graphics.cpp code asks the scenegraph for drawables and then draws them... it's the only thing (that's supposed to be) doing any real calls to openGL.

Messages In This Thread
Shaders under OSX - by aegidian - 02-25-2008, 08:45 PM
[No subject] - by thelusiv - 02-25-2008, 09:45 PM
[No subject] - by aegidian - 02-26-2008, 04:22 AM
Re: Shaders under OSX - by abs1nth - 02-26-2008, 03:04 PM
Re: Shaders under OSX - by aegidian - 02-26-2008, 07:37 PM
[No subject] - by joevenzon_phpbb2_import3 - 02-26-2008, 09:28 PM
[No subject] - by joevenzon_phpbb2_import3 - 03-01-2008, 01:48 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)