Page 1 of 1

Re: Environment Maps

Posted: Thu Jul 15, 2010 3:45 am
by jacmoe

Code: Select all

material Ogre/Skin
{
   technique

   {

	  pass

	  {

		 texture_unit

		 {
			texture GreenSkin.jpg
			tex_address_mode mirror
		 }
		 //rim lighting
		 texture_unit
				  {
			cubic_texture rim.dds combinedUVW
			tex_address_mode clamp
			colour_op_ex add src_texture src_current
			colour_op_multipass_fallback one one
			env_map cubic_normal
		 }

	  }



   }
}
rim.zip
(15.48 KiB) Downloaded 1513 times

Re: Environment Maps

Posted: Mon Aug 27, 2012 10:45 pm
by Beauty
After creating the wiki page Create outline around a character I got this private message:
Treon wrote:Nice of you to make this tutorial: "Create outline around a character"

Maybe you can include some sample how to add during hover of a entity and how to apply this material in "code way".

Thanks
I reply here in public. So it's more useful for others, too. (and doesn't waste my message quota) :wink:
The content was created by user Telchar, not by me. So I can't tell you much.

Treon wrote:how to apply this material in "code way".
There should be different examples in the forums and wiki. Please search for it.
Also have a look to the related Ogre class reference (which contains API descriptions).
For example here is the Material class description:
http://www.ogre3d.org/docs/api/html/cla ... erial.html

Have a look to this wiki page about Materials!!
It contains a few code examples and many useful links at the bottom.
http://www.ogre3d.org/tikiwiki/-Material


Proposal for Jacmoe:
Rename the subject of this topic from Re: Environment Maps to Create outline around a character. This could be more precise.
Additionally I will refer to this topic from the wiki page Create outline around a character for questions.

Re: Environment Maps

Posted: Tue Aug 28, 2012 8:58 am
by Treon
it is possible to apply the rim lightning texture unit on top of the original texture?

Let's say I load a player model that uses its original texture, then I want to put on another layer that can be for example a leather vest. And now I want to apply the rim lighting ontop of that.

Sample:
First I add new texture to current body texture using:

Code: Select all

auto state = new Ogre::TextureUnitState(currentPass, "vest.png");
ptr->addTextureUnitState(state);
Then I apply the rim material.

Code: Select all

auto it = mEntity->getMesh()->getSubMeshIterator();
while(it.hasMoreElements()) {
	auto subMesh = it.getNext();
	if( subMesh ) {
		 subMesh->setMaterialName("Nude/target");
	}
}
Problem here is that when I set setMaterialName it overwrites the old texture with that one in rim lightning material, I want to keep my modified texture of the old pass and just apply a new texture unit (rim lightning on it).

Re: Environment Maps

Posted: Tue Aug 28, 2012 10:43 am
by Beauty
It's possible.
If I'm right, you need to add a second pass to your material definition, which contains the rim lightning.
Additionally you can experiments with options like scene_blend alpha_blend.

Have a look to this wiki page - it contains an example for that:
http://www.ogre3d.org/tikiwiki/Materials

Re: Environment Maps

Posted: Tue Aug 28, 2012 12:14 pm
by Treon
Alright thanks.

Re: Environment Maps

Posted: Wed Oct 30, 2013 3:37 am
by loath
added a c++ version of the material in case it's useful to anyone.

Re: Environment Maps

Posted: Wed Oct 30, 2013 9:13 am
by Beauty
It's nice that you publish code.
But where it is?
The material wiki page wasn't modified in the last months.
(By the way - it contains a dead link on the top of the page.)

Re: Environment Maps

Posted: Wed Oct 30, 2013 5:03 pm
by loath