Try my new website: www.urcho.com - the new SIMPLE social network
blitz code snippets Sign up | 357 members | 125 snippets
Search for:

Username:
Password:


Unique Hardware-Processed Lighting Environments per entity by Drey

[back]
Author: Archive | Viewed: 573 times | Language: BlitzBasic 3D | Category: 3D Effects
Author Comments:
Controls: Right Mouse(with movement) makes the cam rotate around the entity Middle Mouse Resets the camera so its behide the mesh. Normal Mouse Rotation steers the mesh around the environment Mouse Wheel moves the camera away or towards the entity. M shows light markers N shows Active Lights Standard WASD movement Num 4 and 6 rotates lights Num 5 stops them and turns on static mode. Update: Now demoing a better lighting options. This should be saficient for getting how youll make a lighting engine. This is still testing code and ill make a much cleaner system in the future. Still to add is fade in, fade out, light types. I get about 141fps on my machine. Update: To better demo the technique, i modded the code a bit to show how it works with many objects on the screen and to better prove how the lighting will work. Now with 100 objects all gettin their unqiue hardware processed lighting. Basicly, in this demo, 42 "lights" are created. I create a speical types called Objects and MavLights( maverick 2.0 is the name of my engine). Objects have a max value of 8 lights to work on it at once. MaxLights is a variable tho and can be set from 0 to 8. Then with that, the nearest number of lights will be turned on and then the object is to be rendered. Its important to note a few things: Though the light markers in the demo arent, everything else has a default of hidden. The first renderworld doesnt show anything at all, instead, places everything into the Z buffer for later rendering. Its IMPORTANT to change the cameras clsmode to 0,0 after the first renderworld. The light searching system works pretty well, but i want to make some bigger improvements on it. In fact, this section of code probably wont be used in the engine at all. Because im gion to have something called LightPackages. That really help countdown pointless checks and controls a few other properties. If u plan to make a game using this technique. Its important to consider that if u want directional light and such like that. Ull have to make sure to create those properties in your lighting system. Also consider what lights u always want to be on. Directional light should probably always be one of your active lights. I just threw this together. In a few months, u should see more from my engine. For now, i think this techinque is important enough to share. Any comments are welcome. To see the true speed of the system, make sure no markers are on.
Login or create an account to comment on this snippet