Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
 

Avoid Yellowish color in AIS_TexturedShape

Avoid Yellowish color in AIS_TexturedShape
Massimo Del Fedele 2012/12/01 18:35
As seen in some previous posts, AIS_TexturedShape has a bug that prevents using different material than
default one (Bronze), giving to all textured shapes a yellowish color.
After many trial and error, I found a simple patch for AIS_TexturedShape.cxx that solves the problem; from line 369

if (DoRepeat)
mytexture->EnableRepeat();
else
mytexture->DisableRepeat();

const gp_Pnt2d aUVOrigin (myUOrigin, myVOrigin);
const gp_Pnt2d aUVRepeat (myURepeat, myVRepeat);
const gp_Pnt2d aUVScale (myScaleU, myScaleV);

just insert a couple of lines, resulting in :

if (DoRepeat)
mytexture->EnableRepeat();
else
mytexture->DisableRepeat();

myAspect->SetFrontMaterial(Material());
myAspect->SetBackMaterial(Material());

const gp_Pnt2d aUVOrigin (myUOrigin, myVOrigin);
const gp_Pnt2d aUVRepeat (myURepeat, myVRepeat);
const gp_Pnt2d aUVScale (myScaleU, myScaleV);

This will allow TexturedShape to fetch its material during shading; choosing a more 'neutral'
material (like silver-steel-plastic) will then give a quite realistic result.

I'd suggest it as a patch for TexturedShape.cxx

Ciao

Max

 
 
Latest news
  • Open CASCADE Technology 6.8.0 is available for download!
  • New features to enhance the development process
  • Open CASCADE Technology 6.7.1 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map