For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Avoid Yellowish color in AIS_TexturedShape

Massimo Del Fedele's picture
Forums: 

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