Specular map in material

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
lokoyd
Gnoblar
Posts: 1
Joined: Thu Sep 30, 2010 10:51 pm

Specular map in material

Post by lokoyd »

Hello !
By advance, sorry for my bad english ^^
I export meshs from blender to ogre and I would like to know how to use a specular map (png) in a ogre material. Some one could help me please ?

Thanks :)
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: Specular map in material

Post by Jabberwocky »

Regular materials don't support specular maps. You'll need to use a shader. There are some shaders that come with Ogre that you might want to learn about.
Image
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: Specular map in material

Post by madmarx »

C'mon, don't be so extrem!

The good the solution is shaders.

The bad solution that works is to simply use 2 passes.

Code: Select all

pass
{
    diffuse 1 1 1 1
    specular 1 1 1 1
    texture_unit
    {
           texture diffuseMap.png
    }
}
pass specularPass
{
    diffuse 0 0 0 0
    emissive 0 0 0 0
    specular 1 1 1 1 64
    ambiant 0 0 0 0
    texture_unit
    {
           texture mySpecularmap.png
    }
    scene_blend add
}
And that's all folks :D !

Best,
Pierre
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: Specular map in material

Post by Jabberwocky »

I guess that kind of works. :P
It's just unusual to use a specular map without also using a normal map.
Image
User avatar
fantasian
Halfling
Posts: 81
Joined: Fri May 29, 2009 8:47 am
Location: Selanic, Greece
x 2
Contact:

Re: Specular map in material

Post by fantasian »

madmarx wrote:C'mon, don't be so extrem!

The good the solution is shaders.

The bad solution that works is to simply use 2 passes.

Code: Select all

pass
{
    diffuse 1 1 1 1
    specular 1 1 1 1
    texture_unit
    {
           texture diffuseMap.png
    }
}
pass specularPass
{
    diffuse 0 0 0 0
    emissive 0 0 0 0
    specular 1 1 1 1 64
    ambiant 0 0 0 0
    texture_unit
    {
           texture mySpecularmap.png
    }
    scene_blend add
}
And that's all folks :D !

Best,
Pierre
This doesn't work, cause specular is applied on top of the texture, disregarding fully the actual texture.
This SHOULD work:
texture_unit
{
colour_op_ex modulate src_specular src_texture
texture crystal-shard_spec.png
}
but not here (Ogre 1.6)
Post Reply