About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Change material technique/object fading
Author Message
Harry Offline
Member

Post: #1
Change material technique/object fading
Hi,

I have two questions about objects fading and changing material technique:

1. When I changed material technique i had to use mesh->setMaterial(changed_material); but when I change only colors I can use only material.validate(); Does I understand it correct? Is there any way to change technique using only validate?

2. Is there any other way to make objects fade in and out? Now I have to change my material technique to BLEND_LIGHT and then change smoothly alpha parameter to 0 and it doesn't look cool when primary technique was fur for example.
07-08-2012 06:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Change material technique/object fading
1. after any change in Material, Material.validate must be called.
if you change material substantially (like technique or texture count) then Mesh.setShader must be called as well

2. I recommend Mesh.drawBlend (doesn't require changing material params at all)
07-09-2012 01:48 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Change material technique/object fading
Thanks, is it possible to make Mesh.drawBlend to be affected by lightning? Or in this case I should modify material parameters?
07-09-2012 03:10 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Change material technique/object fading
it should be affected by most significant directional light only. other lights are not possible for blending
07-13-2012 01:34 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #5
RE: Change material technique/object fading
I used only one light from sun and when I change it's power object (which mesh was drawing with drawBlend) was still bright.
07-13-2012 06:45 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Change material technique/object fading
please attach some sample images, mesh+mtrl+gfx files, and sample code how you do the drawing of the object.
07-16-2012 07:06 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #7
RE: Change material technique/object fading
Inside my class:

Quote:void Monster::drawBlend()
{
... frustum ...
Vec4 v=Vec4(1,1,1,1);
MaterialLock=material();
mesh->drawBlend(matrix,&v);
MaterialLock=NULL;
}

In Render function:

Quote:case RM_BLEND:
{
monster->drawBlend();
}break;

My class currently based on Game::Obj class but I'm not adding items to ObjMemx container because I'm creating objects of this class in code (so I call drawing manually).

mesh+material+gfx:

http://www.sendspace.com/file/0c3hbb

Edit:
It works ok when material is set to BLEND_LIGHT and TEST_BLEND_LIGHT, but if I understand correct mesh->drawBlend should use blend even when material hasn't got set this technique?
(This post was last modified: 07-16-2012 08:17 PM by Harry.)
07-16-2012 08:08 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: Change material technique/object fading
cool texture, I've reproduced the issue and checking for a fix.
07-18-2012 02:59 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: Change material technique/object fading
should be ok in next SDK
07-18-2012 03:39 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #10
RE: Change material technique/object fading
Thanks x2 but I found it on the internet smile
07-18-2012 04:45 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply