Notifications
Clear all

[Closed] Load Image and assign to render material

Hi

Below how I draw a quad

gw->setMaterial(mtl);
gw->startTriangles();
gw->triangleNCT(&pts[0], &nor[0], &col[0], &uvw[0]);
gw->triangleNCT(&pts[3], &nor[3], &col[3], &uvw[3]);
gw->endTriangles();

The material is initialised

//Set Material properties
mtl.dblSided = 1;
//diffuse, ambient and specular
mtl.Ka = Point3(0, 0, 0);
mtl.Kd = Point3(0, 0, 0);
mtl.Ks = Point3(0, 0, 0);
// Set opacity
mtl.opacity = 1.0f;
//Set shininess
mtl.shininess = 0.0f;
mtl.shinStrength = 0.0f;
mtl.selfIllum = 0.0f;

To load an image I’m using the bitmap manager

Now I want to assign the Bitmap *bmap to the material. The TextureInfo of material is intialized in this way

mtl.texture.setLengthUsed(1);
TextureInfo *ti = &mtl.texture[0];
ti->textHandle = Here is the problem;
ti->uvwSource = UVSOURCE_MESH;
ti->mapChannel = 1;
ti->tiling[0] = ti->tiling[1] = ti->tiling[2] = GW_TEX_NO_TILING;
ti->colorOp = GW_TEX_REPLACE;
ti->colorAlphaSource = GW_TEX_TEXTURE;
ti->colorScale = GW_TEX_SCALE_1X;
ti->alphaOp = GW_TEX_LEAVE;
ti->alphaAlphaSource = GW_TEX_TEXTURE;
ti->alphaScale = GW_TEX_SCALE_1X;

How fucking I get a TexHandle from Bitmap *? From the sdk it seems to be possible trough the TexHandleMaker
But is a pure virtual interface and I have to implement the CreateHandle method?

I feel lost.
Thanks for your help

1 Reply

Hi.
If you haven’t found a solution, did you try using bitmaptexture() or bitmaptex() instead of bitmap manager.
It is the bitmap texture any material will except as texture (maybe not arnold materials).
You can assign bitmap files to bitmaptexture like:
myBitmaptexture.filename=@"C:\folder\subfolder\bitmap.jpg"