[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43106] trunk/blender/source/blender: derivative maps were not working correctly with UV scale ( the texture setting size)

Morten Mikkelsen mikkelsen7 at gmail.com
Tue Jan 3 23:09:30 CET 2012


Revision: 43106
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43106
Author:   mmikkelsen
Date:     2012-01-03 22:09:22 +0000 (Tue, 03 Jan 2012)
Log Message:
-----------
derivative maps were not working correctly with UV scale (the texture setting size)

Modified Paths:
--------------
    trunk/blender/source/blender/gpu/intern/gpu_material.c
    trunk/blender/source/blender/render/intern/source/render_texture.c

Modified: trunk/blender/source/blender/gpu/intern/gpu_material.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_material.c	2012-01-03 19:41:36 UTC (rev 43105)
+++ trunk/blender/source/blender/gpu/intern/gpu_material.c	2012-01-03 22:09:22 UTC (rev 43106)
@@ -1120,7 +1120,7 @@
 						// to inverting the bump map. Should this ever change
 						// this negate must be removed.
 						norfac = -hScale * mtex->norfac;
-						if(found_deriv_map) norfac /= sqrtf(ima_x*ima_y);
+						if(found_deriv_map) norfac /= MAX2(sqrtf(ima_x*mtex->size[0]*ima_y*mtex->size[1]), FLT_EPSILON);
 
 						tnorfac = GPU_uniform(&norfac);
 

Modified: trunk/blender/source/blender/render/intern/source/render_texture.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/render_texture.c	2012-01-03 19:41:36 UTC (rev 43105)
+++ trunk/blender/source/blender/render/intern/source/render_texture.c	2012-01-03 22:09:22 UTC (rev 43106)
@@ -1969,7 +1969,7 @@
 		{
 			auto_bump = shi->obr->ob->derivedFinal->auto_bump_scale;
 		}
-		auto_bump /= sqrtf((float) (dimx*dimy));
+		auto_bump /= MAX2(sqrtf((float) (dimx*dimy)*mtex->size[0]*mtex->size[1]), FLT_EPSILON);
 		
 		// this variant using a derivative map is described here
 		// http://mmikkelsen3d.blogspot.com/2011/07/derivative-maps.html



More information about the Bf-blender-cvs mailing list