Environment Maps

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Environment Maps

Post by jacmoe » Thu Jul 15, 2010 3:45 am

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 1440 times
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
Contact:

Re: Environment Maps

Post by Beauty » Mon Aug 27, 2012 10:45 pm

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.
0 x
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.

Treon
Kobold
Posts: 37
Joined: Mon Mar 07, 2011 2:30 pm

Re: Environment Maps

Post by Treon » Tue Aug 28, 2012 8:58 am

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).
0 x

User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
Contact:

Re: Environment Maps

Post by Beauty » Tue Aug 28, 2012 10:43 am

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
0 x
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.

Treon
Kobold
Posts: 37
Joined: Mon Mar 07, 2011 2:30 pm

Re: Environment Maps

Post by Treon » Tue Aug 28, 2012 12:14 pm

Alright thanks.
0 x

loath
Platinum Sponsor
Platinum Sponsor
Posts: 89
Joined: Tue Jan 17, 2012 5:18 am
x 1

Re: Environment Maps

Post by loath » Wed Oct 30, 2013 3:37 am

added a c++ version of the material in case it's useful to anyone.
0 x

User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
Contact:

Re: Environment Maps

Post by Beauty » Wed Oct 30, 2013 9:13 am

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.)
0 x
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.

loath
Platinum Sponsor
Platinum Sponsor
Posts: 89
Joined: Tue Jan 17, 2012 5:18 am
x 1

Re: Environment Maps

Post by loath » Wed Oct 30, 2013 5:03 pm

0 x

Post Reply