HELP: transparent texture

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
kevin_shanghai
Gnoblar
Posts: 3
Joined: Fri May 02, 2014 8:23 am

HELP: transparent texture

Post by kevin_shanghai »

HI friends!

I am new to OGRE, and just trying to transform my game from irrlicht to OGRE and there is a problem i can't resolve,
I exported a mesh with transparent texture from blender, and it just didn't work in ogre, it is not transparent in the ogre.
can anyone tell me what 's the reason, i am just not able to fix this, though i will investigate ogre about this in future.

the material file is as following, there is no problem in blender and irrlicht

// net genrated by blender2ogre 0.6.0

material net
{
receive_shadows on

technique
{
pass net
{
ambient 0.800000011920929 0.800000011920929 0.800000011920929 0.0
diffuse 0.49671641136283284 0.49671641136283284 0.49671641136283284 0.0
specular 0.23880596458911896 0.23880596458911896 0.23880596458911896 0.0 12.5
emissive 0.0 0.0 0.0 0.0

alpha_to_coverage off
colour_write on
cull_hardware clockwise
depth_check on
depth_func less_equal
depth_write on
illumination_stage
light_clip_planes off
light_scissor off
lighting on
normalise_normals off
polygon_mode solid
scene_blend one zero
scene_blend_op add
shading gouraud
transparent_sorting on

texture_unit
{
texture net.png
tex_address_mode wrap
scale 1.0 1.0
colour_op alpha_blend
}
}
}
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: HELP: transparent texture

Post by Kojack »

In your material there's a line "scene_blend one zero".
this means 100% of the texture and 0% of the background.
Try changing it to "scene_blend alpha_blend" instead.
You might want to remove the colour_op line from the texture unit, that's trying to alpha blend the texture with the incoming diffuse light, which probably isn't what you want. I can't test what would look like, i'm in Mos Burger. :)
User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: HELP: transparent texture

Post by Thyrion »

for my material i had to remove : colour_op alpha_blend
but i dont understand why :)



lol. thx Kojack for the explanation.
kevin_shanghai
Gnoblar
Posts: 3
Joined: Fri May 02, 2014 8:23 am

Re: HELP: transparent texture

Post by kevin_shanghai »

thanks for your reply,
it dose not work, actually i have tried before as what you said.
User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany
x 8

Re: HELP: transparent texture

Post by Thyrion »

ambient 0.800000011920929 0.800000011920929 0.800000011920929 0.0
diffuse 0.6400000190734865 0.6400000190734865 0.6400000190734865 0.0
specular 0.5 0.5 0.5 0.0 12.5
emissive 0.0 0.0 0.0 0.0

alpha_to_coverage off
colour_write on
cull_hardware clockwise
depth_check on
depth_func less_equal
depth_write off
illumination_stage
light_clip_planes off
light_scissor off
lighting off
normalise_normals off
polygon_mode solid
scene_blend alpha_blend
shading gouraud
transparent_sorting on

texture_unit
{
texture UI_cc.tga
tex_address_mode wrap
scale 1.0 1.0
}


this works for me
kevin_shanghai
Gnoblar
Posts: 3
Joined: Fri May 02, 2014 8:23 am

Re: HELP: transparent texture

Post by kevin_shanghai »

thanks, that indeed works!

look like that "depth_write" should be "on"

also "lighting" should be "off", otherwise there is nothing show. but why?
Post Reply