FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Tools
(Moderator: REAS)
   Real Lighting
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Real Lighting  (Read 1361 times)
JohnG

WWW
Real Lighting
« on: Jul 14th, 2004, 5:47pm »

After triyng and failing to understand the processing default lighting model, I decided to start form scratch, and write my own.. and it's coming along pretty well so far.
 
Here's the code as it is currently:
 
http://www.hardcorepawn.com/Lighting/
 
I started by wirting all the normal 3D stuff you need, Vectors, dot and cross product etc, then went on to write the "world" object, that contains all the polys and lights.
 
I got the lighting to work first with just a single level per polygon, but that looked fairly flat, and I then tried per vertex lighting, which looked better, but breaks when a light is near a surface.
 
So what it currently does is assign a "lightmap" to each polygon, then uses this as a texture for the polygon, with the lighting calculated per pixel of the lightmap, so you get nich bright spots in the middle of polys when a light is close, and allows for nice colour blending with multiple light.
 
This isn't a final solution of course, it only works well with evenly sized right angled triangles... but it's a step in the right direction I think.
 
justo


Re: Real Lighting
« Reply #1 on: Jul 14th, 2004, 7:47pm »

thats very very cool...it looks nice and runs well. you may end up writing your own texturer, who knows, if the processing one isnt up to snuff...just something to consider. it would be especially easy with primitive objects with easily calculated uv values...spheres and tori and such.
 
before moving on to that though, you could try adding more complicated lighting...i bet you could get some nice specular effects.
 
looks great though, and doing it yourself is the best way to really get your mind around this stuff.
 
JohnG

WWW
Re: Real Lighting
« Reply #2 on: Jul 14th, 2004, 10:48pm »

How did you guess where I was going with this
 
I've just added specular bump-mapping.
 
http://www.hardcorepawn.com/Bump/
 
Runs a little slower, since it's having to do a fair bit more work per texture pixel now.
 
vent

WWW
Re: Real Lighting
« Reply #3 on: Sep 9th, 2004, 1:00pm »

Great stuff. Are you going to continue adding functionality?
 

http://www.shapevent.com/
JohnG

WWW
Re: Real Lighting
« Reply #4 on: Sep 14th, 2004, 11:59am »

I had intended ot, but I've not had any time recently to do anythign with it.
 
If anyone else wants to extend the functionality, they're quite welcome to do so.
 
Pages: 1 

« Previous topic | Next topic »