About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Transparency & Other Effects
Author Message
Brainache Offline
Member

Post: #1
Transparency & Other Effects
Hey there,

I am looking for a way to "fade out' a mesh... ie: have the mesh render increasingly transparent until it is invisible... Is there anything in place for this?

Also - Is there a way to render the outlines of the mesh ( ie: for a yellow selection outline type of thing)?

Thanks!
12-24-2008 01:14 PM
Find all posts by this user Quote this message in a reply
lucifer1101 Offline
Member

Post: #2
Re: Transparency & Other Effects
it would be good to be able to use shaders like those out of irrlicht.

Although i do not believe that there is support for them here. It might be possible with transparency tho....
12-24-2008 01:33 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
Re: Transparency & Other Effects
Hi you can make a mesh going transparent using an alpha channel with blurred noise, values ranging from 0..255,
and then in the code before rendering manually set the materials alpha color going from 1..0
this will result in something like doom3 effect when killing a monster

as for the outline you mean something like in Diablo 1 outline?
I'll add it to my task list, currently you can only highlight using SetHighlight function which highlights the whole model uniformly like in "game basics\doors" tutorial when moving the mouse over the door
12-24-2008 04:18 PM
Find all posts by this user Quote this message in a reply
Brainache Offline
Member

Post: #4
Re: Transparency & Other Effects
Regarding transparency... Can you give me a quick example of how to add the alpha channel effect? ( I've been attempting to modify the chr class's material and so far only resulitng in crashing...)

Regarding highlighting - Diablo style.. ie: Render the mesh with a tellow silhouette outline...
12-26-2008 11:54 PM
Find all posts by this user Quote this message in a reply
lucifer1101 Offline
Member

Post: #5
Re: Transparency & Other Effects
these are just a few things i found on alpha, see if you can use them


alpha() : Esenthel::DisplayState , DisplayState
alpha_add : Esenthel::RippleFx , RippleFx
alpha_mode : Esenthel::Image , Image
alpha_scale : Esenthel::RippleFx , RippleFx
alphaFromGreen() : Esenthel::Gfx , Gfx
alphaFromKey() : Esenthel::Gfx , Gfx

Im an official Esenthel Nooblet
12-27-2008 02:37 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
Re: Transparency & Other Effects
for alpha channel effect you need to have alpha texture (0.a.png) it must be the same size as color texture,
for testing make it blurred noise
use the texture when creating Material Textures in Mesh Editor mode
make sure technique ALPHA is selected

now you need to change alpha color while rendering

Code:
void Chr::draw()
{
  Flt desired_alpha= .. ; // set your desired alpha level 0..1
  if(mesh)REPA(*mesh) // iterate through all containers
  {
       Mshc &mshc=mesh->C(i);
       REPA(mshc.material) // iterate through all materials
          if(mshc.material[i]) // if it points to a valid material
              mshc.material[i]->color.w=desired_alpha; // set w component which is alpha
  }
   __super::draw();
}
12-27-2008 11:23 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
Re: Transparency & Other Effects
I've added mesh outlining in the latest engine version
01-02-2009 07:32 PM
Find all posts by this user Quote this message in a reply
lucifer1101 Offline
Member

Post: #8
Re: Transparency & Other Effects
awesome, im actually trying to do this in another engine atm but i cant do it...

Im an official Esenthel Nooblet
01-03-2009 12:23 AM
Find all posts by this user Quote this message in a reply
smartwhiz Offline
Member

Post: #9
RE: Transparency & Other Effects
Hello
I have been working on your outline demo itself, what I wanted to try out is the 50% alpha 3d model itself.

Code:
Mesh g_Box;
g_box.create(1).base(0).create(Box(0.5),VTX_TEX0|VTX_NRM|VTX_TNG);
g_box.setMaterial(glass).setRender().setBox();

      m_Material=*glass;
      m_Material.color.v3()=ColorHue(128.0).asVec();
      m_Material.validate();

g_box.setMaterial(&m_Material).draw(Matrix(m_Pos));

I tried to change the m_Material.color.w = 0.5; but there is no change on the alpha of the material. Am I missing something?
(This post was last modified: 10-16-2010 09:12 PM by smartwhiz.)
10-16-2010 09:09 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: Transparency & Other Effects
you need to store a copy of the Material globally (in constant memory address)
'draw' doesn't draw yet, but adds mesh to batch list, with pointer to material

but if you want to use smooth transparency on solid material, you should call drawBlend instead (call it inside RM_BLEND rendering mode) it accepts "Vec4 *color" parameter where you can easily set modifications
10-16-2010 09:42 PM
Find all posts by this user Quote this message in a reply
Post Reply