Re: Problem with normalmap

res <[email protected]> Sun, 28 Jul 2013 15:06:58 +0200
Newsgroups gmane.comp.graphics.crystalspace.devel
Message-ID <[email protected]>
On 27.07.2013 01:49, Naman Gupta wrote:
>   res, was CS/data/shader-snippet/tcoffset2-perturb-normal.xml left
> incomplete?
>   was it suppose to pass "z killed normal" in simple float3 ?

I don't think so. Z is zeroed out in the tcoffset2-perturb-normal-cam
snippet because a transformation from tangent to camera space will take
place; with a non-zero Z this could result in unwanted (I think) extra
distortions when the camera is tilted.

>    Phew, I finally figured why the normal maps in weaver was showing
> such weird results.
>
>    It's because normal,tangent and bitangents are NOT provided by the
> watermesh plugin and I failed to see in the "outer" code as it is
> triggered by coercion.
>
>   The way I see it to work around with this problem is to alter
> tcoffset snippet. or maybe...
>

Well, or you provide tangents and bitangents.
Though that probably means getting them must move out of the coercion
library… the position snippet looks like an appropriate place.
There's some precedent for a value generated by the position snippet but
consumed by coercion snippet; specifically, it's the object-to-world
transform. For general meshes, it's passed in a shader var, but for
instanced meshes it has to be computed per instance. So, the position
snippet stores that transform in a global variable, and the coercion
snippets needing object2world take it from there – and it doesn't matter
whether the mesh is instanced or not.
If the same was done for tangent & bitangent, you could write a “water”
position snippet that computes them in the shader.

-f.r.

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

_______________________________________________
Crystal-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-develop
signature.asc (application/pgp-signature, 263 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlH1F3YACgkQNCTzcE/07exejQCfVAXK/yASKoCmlq2+aJsg9a1n
wlEAniMZ1XQ9diI4tWQBrs14OIRD1NQT
=f2At
-----END PGP SIGNATURE-----