[cgkit-commits] SF.net SVN: cgkit: [5] cgkit/trunk
Brought to you by:
mbaas
From: <mb...@us...> - 2006-05-29 13:32:54
|
Revision: 5 Author: mbaas Date: 2006-05-29 06:32:40 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/cgkit/?rev=5&view=rev Log Message: ----------- 1) Modified the shaders for the built-in materials so that they can be used for baking. 2) The transformation of the object was ignored during baking. This led to incorrect results when the transformation was anything else than the identity. Modified Paths: -------------- cgkit/trunk/cgkit/material3ds.py cgkit/trunk/cgkit/objmaterial.py cgkit/trunk/cgkit/ribexport.py cgkit/trunk/changelog.txt Modified: cgkit/trunk/cgkit/material3ds.py =================================================================== --- cgkit/trunk/cgkit/material3ds.py 2006-05-29 13:29:33 UTC (rev 4) +++ cgkit/trunk/cgkit/material3ds.py 2006-05-29 13:32:40 UTC (rev 5) @@ -346,9 +346,11 @@ float refl_rotation = 0; float refl_percent = 0.0; float refl_blur = 0.0; + varying point Pref = point(0,0,0); ) { - normal Nf = faceforward(normalize(N),I); + BAKE_BEGIN + normal Nf = BAKE_NORMAL(N); color C_diffuse = diffuse_col; color C_specular = specular_col; color C_opacity = Os; @@ -449,6 +451,7 @@ Ci = mix(Ci, C_diffuse, final_self_ilpct); Oi = C_opacity; Ci *= Oi; + BAKE_END } """ Modified: cgkit/trunk/cgkit/objmaterial.py =================================================================== --- cgkit/trunk/cgkit/objmaterial.py 2006-05-29 13:29:33 UTC (rev 4) +++ cgkit/trunk/cgkit/objmaterial.py 2006-05-29 13:32:40 UTC (rev 5) @@ -311,9 +311,12 @@ string map_d = ""; float map_d_offset[3] = {0, 0, 0}; float map_d_scale[3] = {1, 1, 1}; + + varying point Pref = point(0,0,0); ) { - normal Nf = faceforward(normalize(N),I); + BAKE_BEGIN + normal Nf = BAKE_NORMAL(N); color _Ka = Ka; color _Kd = Kd; color _Ks = Ks; @@ -383,6 +386,7 @@ Oi = _d*Tr*Tf; Ci *= Oi; + BAKE_END } """ Modified: cgkit/trunk/cgkit/ribexport.py =================================================================== --- cgkit/trunk/cgkit/ribexport.py 2006-05-29 13:29:33 UTC (rev 4) +++ cgkit/trunk/cgkit/ribexport.py 2006-05-29 13:32:40 UTC (rev 5) @@ -1108,8 +1108,9 @@ # verts = 156*[(0,0,0)] # Create parameter list... + W = obj.worldtransform params = {"P":stcoords, - "Pref":geom.verts} + "Pref":map(lambda x: W*x, geom.verts)} RiDeclare("Pref", "vertex point") clss = ["constant", "uniform", "varying", "vertex", "facevarying", "facevertex", "user"] typs = ["integer", "float", "string", "color", "point", "vector", @@ -1126,7 +1127,7 @@ decl = "%s %s[%d]"%(cls, typ, multiplicity) RiDeclare(name, decl) - # RiCoordSysTransform("camera") +# RiCoordSysTransform("camera") RiPointsPolygons(len(geom.faces)*[3], list(geom.faces), params) def renderChilds(self, obj): @@ -1767,9 +1768,11 @@ float texenvcolor_alpha = 1; float blend_sfactor = -1; float blend_dfactor = -1; + varying point Pref = point(0,0,0); ) { - normal Nf = faceforward(normalize(N),I); + BAKE_BEGIN + normal Nf = BAKE_NORMAL(N); vector V = normalize(-I); color diffuse = Cs; @@ -1846,6 +1849,7 @@ Ci = S*Ci; Oi = 1-D; } + BAKE_END } """ Modified: cgkit/trunk/changelog.txt =================================================================== --- cgkit/trunk/changelog.txt 2006-05-29 13:29:33 UTC (rev 4) +++ cgkit/trunk/changelog.txt 2006-05-29 13:32:40 UTC (rev 5) @@ -7,6 +7,11 @@ Bug fixes/enhancements: +- The built-in materials (GLMaterial, Material3DS, OBJMaterial) can now + also be used for baking. +- Bugfix: When baking maps, the transformation of the object was ignored. + This led to incorrect surface shading when the transformation was + anything else than the identity. - WorldObjects now support comparison (i.e. two WorldObject wrappers that reference the same C++ object will now appear as identical) - The setup script was checking for Boost.Python headers even when the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |