Jump to content

Semi-transparent models


Rick
 Share

Recommended Posts

I've never actually been able to get semi-transparent models to work in LE. What exactly is required to get a model to be semi-transparent?

 

1) Does anything in the material or texture need to be different from a model that I would draw in the main world?

 

2) How do you set the level of transparency to this model?

 

3) Is the level of transparency specific to each model or the entire transparent world?

 

 

What I'm currently doing is the following but the model has 0 transparency. It looks normal.

 

function object:LoadTransparentModel()
	-- Change to transparent layer
	SetWorld(fw.transparency.world)

	-- Load assassin model that will be transparent
	object.transparentModel = LoadModel("abstract::fantasy_bad_assassin.gmf")
	object.transparentModel:SetPosition(object.model:GetPosition(1), 1)
	object.model:Hide()
	EntityColor(object.transparentModel, Vec4(1, 1, 1, .3))

	-- Go back into main layer
	SetWorld(fw.main.world)
end

Link to comment
Share on other sites

MESH.FRAG takes the alpha of the model, so you've set it to 0.3 and later if you have LW_DIFFUSE defined it multiplies diffuse with the texture values. So possibly it's worth checking the models alpha channel and if it's pulling out a ZERO it's probably that.

 

Materials are well worth checking here as your function (above) looks fine to me.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

Just add blend=alpha as Metatron posted and try it. If still no joy add an alpha layer to the texture. It shouldn't be difficult to do.

 

Your setting of the alpha in code should work as you intend (it's multiplying that value with another). You should be able to control fade in and out by adjusting the alpha in SetColor() once you get the texture and blend sorted out.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

Can't seem to get this working. Here is the mat file I'm using with the above code. The result looks just normal. The model doesn't look transparent at all.

 

texture0="Orc_D2.dds"
texture1="Orc_N2.dds"
alpha=blend
shader="abstract::mesh_diffuse_bumpmap_skin.vert","abstract::mesh_diffuse_bumpmap_specular.frag"
shadowshader="abstract::mesh_shadow_skin.vert"

 

If you can add an alpha layer to the texture so it's just solid and add blend=alpha

 

I'm saving the texture as DXT5(Alpha) so guessing it has that Alpha layer. Has anyone done something like this before with the framework and if so if they could share all the details about how they got it to work that would help.

Link to comment
Share on other sites

texture0="Orc_D2.dds"

texture1="Orc_N2.dds"

alpha=blend

shader="abstract::mesh_diffuse_bumpmap_skin.vert","abstract::mesh_diffuse_bumpmap_specular.frag"

shadowshader="abstract::mesh_shadow_skin.vert"

 

take another look at that...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...