GLBasic forum

Main forum => GLBasic - en => Topic started by: Sebastian on 2008-Jul-03

Title: Smooth Lighting
Post by: Sebastian on 2008-Jul-03
Ok, as promised my entry to the topic "Lighting".
Don't know if Per Pixel lighting or something else: I called it "Smooth Lighting". GLBasic does a pretty good job with the lighting of 3D models, as long as you don't use realtime shadows. With shadows however... well, look for yourself.
The zip file contains the complete project incl. sourcecode and compiled executables for Windows (tested under Vista Home Basic), Mac OS X and Linux. All the files are in there, if you have questions or something else just post it here  :booze:

http://www.box.net/shared/exvjbjvokw (http://www.box.net/shared/exvjbjvokw)

The trick: one can see how the lighting gets better when using a plain white bitmap as normal map instead of no normal mapping. The render modes can be set with the keys 0 to 4.

ATTENTION: Please edit the .ini file! Set the resolution and fullscreen values because I think I left them at 144x900 fullscreen  :whistle:
Title: Re: Smooth Lighting
Post by: Moru on 2008-Jul-03
#2 looks much better than #1, #3 and #4 crashes so can't realy see. The program don't compile on my computer, missing the CreateCube function :-)
Title: Re: Smooth Lighting
Post by: Sebastian on 2008-Jul-03
The CreateCube function is part of the 3DPrimitives.gbas
You find that in GLBasic\Samples\Common. You need to include that file as source (or just copy&paste the CreateCube function).
It would be very interesting, why 3 and 4 crash.

#0 is what you see at the beginning (no texture, no bump mapping; plain white cube)
#1 is the same white cube but with a white texture used as normal map

#2 is the cube with a simple texture
#3 is the same cube, the same texture but again with a white texture used as normal map

#4 is the cube, texture and real normal map

So if you speak of #1 and #2 could it be that you're actually refering to #0 and #2 and every mode that uses dot3 mapping crashes? Just press "1" when running the demo...
Title: Re: Smooth Lighting
Post by: Moru on 2008-Jul-03
ah yes, it was 0 and 2, I was sure I was flipping between them but I guess I only pressed once on #2 expecting 1 to be the first one. #0 and #2 works, all else crashes.
Title: Re: Smooth Lighting
Post by: Sebastian on 2008-Jul-03
Can you compile and run the Dot3 (normalmapping) examples that come with GLBasic?
And what is your hardware?
Title: Re: Smooth Lighting
Post by: Moru on 2008-Jul-04
I found the error, disabled "Optimized threading" in the drivers for my NVIDIA 6600 card. Remember reading something about it in some other thread. I just updated the drivers last week so that was when it stopped working I guess.
Title: Re: Smooth Lighting
Post by: Moru on 2008-Jul-04
No, didn't fix it. That only fixed crashes with the CellShading sample, your program is still crashing... mabe some other thing in the drivers.