How to transparent 1 mesh using same material?

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
papaonn
Kobold
Posts: 30
Joined: Wed Nov 13, 2013 5:59 pm
x 1

How to transparent 1 mesh using same material?

Post by papaonn »

Hi community,

how to set transparent on particular single mesh object using the same material by multiple meshes?

Currently i am able to transparent by setting the diffusion alpha value of particular material,
however it will also make other objects transparent as well.

How do i control such that same material shared by multiple meshes could only allow transparency for particular mesh?


Thank you.
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: How to transparent 1 mesh using same material?

Post by c6burns »

Use 2 materials, one transparent and one not.
papaonn
Kobold
Posts: 30
Joined: Wed Nov 13, 2013 5:59 pm
x 1

Re: How to transparent 1 mesh using same material?

Post by papaonn »

Hi thanks for reply,
do you mean cloning the material?

Because it is set by external file .material,
and i just use the createEntity(entityName, meshName) function to load the external .mesh file,
so it automatically look up for the .material file.
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: How to transparent 1 mesh using same material?

Post by c6burns »

You can either create 2 materials using scripts, or do it programmatically (eg. clone and set transparancy on the new material). Doesn't matter which. Then use Entity::setMaterial or setMaterialName to assign the material. It doesn't matter what material is hardcoded into the .mesh file, just override it after it loads.
papaonn
Kobold
Posts: 30
Joined: Wed Nov 13, 2013 5:59 pm
x 1

Re: How to transparent 1 mesh using same material?

Post by papaonn »

Thanks bro,
I will try it when i'm home today!
Post Reply