[tuhopuu-devel] playing with render code

Leon Turner tuhopuu-devel@blender.org
Sat, 6 Mar 2004 02:53:53 +0000 (GMT)


hi all,

I was playing around with the render code the other
weekend as a break from the particles for a bit (just
learning my way round the code!).

I hacked a couple of things, but I'm not sure whether
they're really useful or done in a particularly good
way.  I'm not planning on spending much more time on
these, but I thought I'd mention it just in case
someone's interested.

Here's a little overview: 

1) Using rendertime radiosity to light textures.
I extended the structure ShadeInput in render_types.h
to include a new variable tex_for_radio[3]. In
texture.c, function do_material_tex I populate this
with the texture results, Tr, Tg, Tb (somewhere around
line 1360). Basically, this then contains the result
you'd have using "shadeless" on a material.

Then in rendercore.c, function shade_lamp_loop, I
multiply the radiosity values by the stored values
(somewhere around line 2000). It seems to work fine -
much better than using hemi's etc. I've also added a
button in the shaders panel to switch this on or off.

2) An extra "map-to" option for textures - "shadow"
This is done in a very similar way - the shadow values
are stored in a new variable in ShadeInput, then used
to reduce the diffuse/specular light amount in
shade_lamp_loop in rendercore.c . It lets you use a
texture to reduce the amount of light falling on a
surface. 

Works nicely if you want a nice smooth simple shadow
from a non-moving object in an animation, without any
render time hit - obviously, it means extra work in
GIMP or photoshop though!

Anyway, let me know if this is useful / desirable and
I can put a patch together or commit.

Cheers

Leon




	
	
		
___________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html