[Bf-committers] parallaxmap error

Ton Roosendaal ton at blender.org
Fri Dec 17 11:50:47 CET 2004


Hi Alfredo,

Thanks for the code sample, this is a very welcome addition to Blender.  
:)
However, I think you've misunderstood the purpose of "Warp" as  
currently coded. I didn't aim at parallax mapping at all (nor as  
special support for normal maps), but wanted to provide a method to  
deform texture coordinates, like how normals can be influenced or how  
displacement mapping works. For that reason the normal vector output of  
textures is directly applied to the texture coordinates of the next  
channel. This is useful in many cases, but mostly just for artistic  
control. It was a feature I liked to have a long time before, not  
related to normal maps.

A parallax mapping option should reside next to that, it's something  
very different, as your code below already illustrates;

	float tvi[3], bh = mtex->warpfac*(0.5f - (Tr+Tg+Tb)*0.333333333f);
	VECCOPY(tvi, shi->view);
	if (shi->vlr && shi->vlr->ob) Mat4Mul3Vecfl(shi->vlr->ob->imat, tvi);
	warpvec[0] = tvi[0] * bh;
	warpvec[1] = tvi[1] * bh;
	warpvec[2] = tvi[2] * bh;

What I don't understand is;

- What is the reason for averaging the RGB output of textures? How can  
texture RGB output be of interest for modulating a displacement?
- I assume this is a special case for normal maps? If that's true, the  
'warp' as used here should be applied to the same channel... and then  
still, what's averaging RGB doing with it?
- Or, is this is a generic trick for any texture type in Blender?

I can experiment a bit with this to check on the best way to integrate  
it. And, BTW, I'm also already working on killing all these ugly  
globals from texture code :)

-Ton-


On 16 Dec, 2004, at 21:35, Alfredo de Greef wrote:

> Obviously I did it in a hurry, I forgot one line, the
> vector needs to be normalised after the matrix
> multiply. I was wondering why the warp factor needed
> to be set so high. With normalisation the warp factor
> needs to be set lower, around 0.1, although that is
> about maximum already.
> Also, didn't really explain this, but the order is
> first heightmap set to warp, then color and normalmap.
> You don't need normalmaps for this, a heightmap can
> also be used for bumpmapping as well of course, but if
> you want to use the original heightmap, then it needs
> to be copied to the second channel, since the warp
> texture affects the next channels. Also needs to be
> inverted in that case (twice nor button, yellow
> state).
>
> Alfredo
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list