Adding Photoshop blending modes to the RT Shader System
-
Assaf Raman
- OGRE Team Member

- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Adding Photoshop blending modes to the RT Shader System
Nir and I talked about a requirement that we got from an artist to have a blending mode named "Overlay" that Photoshop has - as a new blending mode that the RT Shader System can have for textures.
After searching a bit I found this link that shows the math behind photoshop blanding modes. (the bottom of the page also has sample images).
I also found this link that implements all of them in glsl.
I think that adding all of the modes will be the best thing and will give the most to the users. Shouldn't be hard - we have them all in glsl so converting them to CG should be easy.
We can also use the images from the first link as use samples.
Is this a good idea?
After searching a bit I found this link that shows the math behind photoshop blanding modes. (the bottom of the page also has sample images).
I also found this link that implements all of them in glsl.
I think that adding all of the modes will be the best thing and will give the most to the users. Shouldn't be hard - we have them all in glsl so converting them to CG should be easy.
We can also use the images from the first link as use samples.
Is this a good idea?
You do not have the required permissions to view the files attached to this post.
Watch out for my OGRE related tweets here.
-
Assaf Raman
- OGRE Team Member

- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Adding Photoshop blending modes to the RT Shader System
I missed it - but now I see he also wrote the shaders in hlsl. Look here.
You do not have the required permissions to view the files attached to this post.
Watch out for my OGRE related tweets here.
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
Re: Adding Photoshop blending modes to the RT Shader System
Makes sense since that's how artists tend to think of things.
-
xavier
- OGRE Retired Moderator

- Posts: 9481
- Joined: Fri Feb 18, 2005 2:03 am
- Location: Dublin, CA, US
- x 22
Re: Adding Photoshop blending modes to the RT Shader System
Can't count the number of times an artist has said to me "but it looks how I want in Photoshop"...
-
Nir Hasson
- OGRE Retired Team Member

- Posts: 363
- Joined: Wed Nov 05, 2008 4:40 pm
- Location: TLV - Israel
- x 2
Re: Adding Photoshop blending modes to the RT Shader System
That looks cool !!
I will add it to my task list on high priority
I think the best place is to extend the texture unit blend modes and override the FFP texturing stage with these cool blend modes.
I liked it
I will add it to my task list on high priority
I think the best place is to extend the texture unit blend modes and override the FFP texturing stage with these cool blend modes.
I liked it
-
Assaf Raman
- OGRE Team Member

- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Adding Photoshop blending modes to the RT Shader System
Can I add this to the roadmap\help wanted and make this thread public?
Watch out for my OGRE related tweets here.
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
Assaf Raman
- OGRE Team Member

- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Adding Photoshop blending modes to the RT Shader System
Done.
Watch out for my OGRE related tweets here.
-
Assaf Raman
- OGRE Team Member

- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Adding Photoshop blending modes to the RT Shader System
I found this great article that really does a good job showing off the photoshop blending modes.
The nice thing is that the we can add the textures and images in the article to a new sample to demonstrate the blending mode - they have free licenses.
The nice thing is that the we can add the textures and images in the article to a new sample to demonstrate the blending mode - they have free licenses.
Watch out for my OGRE related tweets here.
-
bishopnator
- Gnome
- Posts: 348
- Joined: Thu Apr 26, 2007 11:43 am
- Location: Slovakia / Switzerland
- x 16
Re: Adding Photoshop blending modes to the RT Shader System
Hi, I think more interesting link is this: http://www.nathanm.com/photoshop-blending-math/. There are equations for each blending mode from PS instead of verbal description of blending modes.
-
Assaf Raman
- OGRE Team Member

- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Adding Photoshop blending modes to the RT Shader System
Your link is the first link on the first post on this thread...bishopnator wrote:Hi, I think more interesting link is this: http://www.nathanm.com/photoshop-blending-math/. There are equations for each blending mode from PS instead of verbal description of blending modes.
Watch out for my OGRE related tweets here.
-
Assaf Raman
- OGRE Team Member

- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Adding Photoshop blending modes to the RT Shader System
A friend implemented this feature (not me).
Just committed to the trunk.
Only the CG version for now.
Added an entity that shows the feature to the RTSS sample - a rock wall with the OGRE logo blended with the new "overlay" blend.
Here is how the material file looks like for this sample:
Just committed to the trunk.
Only the CG version for now.
Added an entity that shows the feature to the RTSS sample - a rock wall with the OGRE logo blended with the new "overlay" blend.
Here is how the material file looks like for this sample:
Code: Select all
material RTSS/Example-LayeredBlending
{
technique
{
pass
{
lighting off
texture_unit
{
scale 0.1 0.1
texture rockwall.tga
}
texture_unit
{
// RT Shader system section - required by the comming layered blend extension.
rtshader_system
{
layered_blend blend_overlay
}
texture ogrelogo.png
}
// RT Shader system section.
rtshader_system
{
texturing_stage layered_blend
// you must have this section (even with only texturing_stage layered_blend) for the layered blend to
// work. Also - this section must me the last one in the pass.
}
}
}
}You do not have the required permissions to view the files attached to this post.
Watch out for my OGRE related tweets here.
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
Nir Hasson
- OGRE Retired Team Member

- Posts: 363
- Joined: Wed Nov 05, 2008 4:40 pm
- Location: TLV - Israel
- x 2
Re: Adding Photoshop blending modes to the RT Shader System
I just commited some fixes to this brand new feature.
Also changed the sample to show all the blend modes...
Seems like I'm running out of space for UI components..
Also changed the sample to show all the blend modes...
Seems like I'm running out of space for UI components..
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Adding Photoshop blending modes to the RT Shader System
Out of curiosity, in setupContent there's a check for DX9, is it needed? Or could that be changed to check for a specific rendersystem capability perhaps? Otherwise we'll have to expand it to cover DX10, 11 and GLES 2, I think.
-
Nir Hasson
- OGRE Retired Team Member

- Posts: 363
- Joined: Wed Nov 05, 2008 4:40 pm
- Location: TLV - Israel
- x 2
Re: Adding Photoshop blending modes to the RT Shader System
I added this check for now because we don't have glsl shader implementation.
I'll remove it when it will be available.
I'll remove it when it will be available.
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Adding Photoshop blending modes to the RT Shader System
Cool cool. I'll probably check that in soon. Just gotta test it and the GLSL ES version.
-
Nir Hasson
- OGRE Retired Team Member

- Posts: 363
- Joined: Wed Nov 05, 2008 4:40 pm
- Location: TLV - Israel
- x 2
Re: Adding Photoshop blending modes to the RT Shader System
I added the GLSL implementation...
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Adding Photoshop blending modes to the RT Shader System
GLSL ES is coming soon. About half of them work. I discovered a shortcoming of the GLSL ES writer that I need to work out first. It's something that will need to be fixed anyway so now is as good a time as any!
-
Assaf Raman
- OGRE Team Member

- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Adding Photoshop blending modes to the RT Shader System
New video on the showcase forum thread.
Watch out for my OGRE related tweets here.
-
roimatola
- Halfling
- Posts: 58
- Joined: Fri Sep 07, 2007 4:57 pm
Re: Adding Photoshop blending modes to the RT Shader System
Hi friends, just a quick question. This kind of blend modes you are covering here refers only to blending between textures, right? Not scene blending like the already supported by Ogre add, modulate or alpha_blend?
-
Mattan Furst
- OGRE Retired Team Member

- Posts: 260
- Joined: Tue Jan 01, 2008 11:28 am
- Location: Israel
- x 32
Re: Adding Photoshop blending modes to the RT Shader System
@roimatola
That is correct. There is currently no way of extending the scene blends through shaders anyway, at least not in OpenGL and DirectX9/10/11.
That is correct. There is currently no way of extending the scene blends through shaders anyway, at least not in OpenGL and DirectX9/10/11.
it's turtles all the way down
-
roimatola
- Halfling
- Posts: 58
- Joined: Fri Sep 07, 2007 4:57 pm
Re: Adding Photoshop blending modes to the RT Shader System
bummmer.. I would think that a particle system with an overlay blending mode over the scene would make an incredible effect! Thanks a lot for the answer!
-
masterfalcon
- OGRE Retired Team Member

- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: Adding Photoshop blending modes to the RT Shader System
I just noticed what might be a typo in RTShaderSystem.material. Is this parameter correct?
I end up getting the "Expected one of the following blend modes" error in my log when the material is parsed.
Code: Select all
layered_blend blend_luminosity-
Mattan Furst
- OGRE Retired Team Member

- Posts: 260
- Joined: Tue Jan 01, 2008 11:28 am
- Location: Israel
- x 32
Re: Adding Photoshop blending modes to the RT Shader System
That would be my fault. I while back I changed the naming conventions in the layered blend modes to be more consistent with Ogre (e.g. removed capital letters, added underscores, removed the word "blend_" from all the modes which seemed redundant).
blend_luminosity should just be luminosity. I'll fix it.
blend_luminosity should just be luminosity. I'll fix it.
it's turtles all the way down
