Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] Re: TexCoordTexture


Chronological Thread 
  • From: Li-Ta Lo < >
  • To:
  • Subject: [Manta] Re: TexCoordTexture
  • Date: Wed, 09 Jul 2008 10:08:39 -0600
  • Organization: Los Alamos National Lab


On Wed, 2008-07-09 at 08:44 -0600, Li-Ta Lo wrote:
> Hi,
> 
> This is more a follow up on the question of vertex color v.s. surface
> color. If I understand Thiago's reply and the problem correctly, we
> should be able to use the vertex's RGB color as its 3D texture 
> coordinate. MeshTriangle will take these "t-coords" at vertices and 
> interpolate them for interior points. The t-coords of interior points 
> can then be treated as their RGB colors. The it will work exactly as 
> how traditional smooth shading works. Is there any flaw in my idea?
> 
> BTW, why TexCoordTexture only uses 2 components of the texture
> coordinates while 3D texture coordinates were computed?
> 
> void TexCoordTexture::mapValues(Packet<Color>& results,
>                                 const RenderContext& context,
>                                 RayPacket& rays) const
> {
>  
>   // Compute the texture coordinates.
>   rays.computeTextureCoordinates3( context );
>     
>   for( int i = rays.begin(); i < rays.end(); ++i ) {
>     Vector texCoords = rays.getTexCoords(i);
>     // Convert the coordinates to a color.  
>     results.set(i, Color( RGB( (ColorComponent)texCoords[0],
>                                (ColorComponent)texCoords[1],
>                                (ColorComponent)0 ) ) );
>   }
>    
> } // end mapValues
> 

O.K. it works. Can someone please apply this patch?

Index: TexCoordTexture.cc
===================================================================
--- TexCoordTexture.cc  (revision 2302)
+++ TexCoordTexture.cc  (working copy)
@@ -51,7 +51,7 @@
     // Convert the coordinates to a color.
     results.set(i, Color( RGB( (ColorComponent)texCoords[0],
                                (ColorComponent)texCoords[1],
-                               (ColorComponent)0 ) ) );
+                               (ColorComponent)texCoords[2] ) ) );
   }
 
 } // end mapValues

Ollie





Archive powered by MHonArc 2.6.16.

Top of page