Momoko, thank you for answering. Your corrects are really cool.
Hemispheric lighting - yes this is fake. but it intended for cases like graphics for smartphones. For example, you have only one light and ambient, and normal maps. So you want to normal maps worked on back face of meshes. So this method will be very helpful for seeing normal mapping on a back side of meshes.
Reflection
Well, I achieved the reflection effect like in Left 4 dead 2, or even Eve online. Currently it looks very good. I tried to use Fresnel of your Lighting reflection, but I did not found any good result with experimenting it. Possibly i did not found the right usage of it. My proposal is to make some tests with your and mine reflections.
Setting uniform values
Thank you for your correction. So, as I understand i should remove values. And the values should be set in a material. Right?
Limiting diffuse/specular colors to 1
I get you. Iāll remove those things.
Emission map
I would say that glow map should be the same as emission map. And if your project do not use glow effect at all? For example, a project for android phone.
Also, in L4D you can switch low quality settings on and there will be no any glow evvect, but you will see the emission. I think that emission surely should be.
Something else you would like to add?
About reflections, what model do you want to take for testing? Does my character suits?
mifth said:
Setting uniform values
Thank you for your correction. So, as I understand i should remove values. And the values should be set in a material. Right?
Yes.
mifth said:
Emission map
I would say that glow map should be the same as emission map. And if your project do not use glow effect at all? For example, a project for android phone.
Also, in L4D you can switch low quality settings on and there will be no any glow evvect, but you will see the emission. I think that emission surely should be.
It doesn't matter if the glow effect is used or not. For the lighting material, all it has to do is just add the glowmap value to the result color. It will work with and without bloom.
mifth said:
About reflections, what model do you want to take for testing? Does my character suits?
You can see an example where reflection works correctly in TestEnvironmentalMapping example in jME3 tests. Notice how the window and the doors on the vehicle reflect the skybox.
Emission map:
Actually, I cant find how to glow map get work without glow effect. I did screenshot with emissive and glow maps:
Uploaded with ImageShack.us
Reflection:
My reflection works in the same way as default and has much more settings:
http://www.youtube.com/watch?v=tTS4xZj8Svw
Starting from 1.10minute is default reflection, then i tried to repeat it with mine.
mifth said:
Emission map:
Actually, I cant find how to glow map get work without glow effect. I did screenshot with emissive and glow maps:
Yes, it does not work right now of course. This is because the glow map is not used in the lighting shader. I was suggesting that we merge the two to serve the same purpose
mifth said:
Reflection:
My reflection works in the same way as default and has much more settings:
Starting from 1.10minute is default reflection, then i tried to repeat it with mine.
I don't understand what you mean by "more settings". The fresnel params contains 3 floats for you to tweak, your shader only has 1. But thats beside the point, we are talking about realism here, your shader does not take into account the diffuse color or the Fresnel equation, so the result looks like a simple reflection without any lighting.
Reflection:
I donāt mind to use your reflection calculation. The only one thing i ask you:
- count normal and tbnMatrix for normal map reflection. (mat = tbnMat)
- count reflection by specular map. (see my fragment shader)
[java]
#ifdef USE_REFLECTION
#if defined (USE_REFLECTION) && defined (NORMALMAP)
normal = normalize(normal);
mat = normalize(mat);
vec4 refColor = Optics_GetEnvColor(m_EnvMap, (refVec.xyz - mat.xyz * normal.xyz)*5.0);
#elif defined (USE_REFLECTION) && !defined (NORMALMAP)
vec4 refColor = Optics_GetEnvColor(m_EnvMap, refVec.xyz);
#endif
// Interpolate light specularity toward reflection color
// Multiply result by specular map
specularColor = mix(SpecularSum2 * light.y, refColor, refVec.w) * specularColor;
SpecularSum2 = vec4(1.0);
light.y = 1.0;
#endif
[/java]
Emission:
I hope it will be written in Lighting shader. Another reason to use my Emission instead of Glow:
Glow is an rgb texture + mipmaps. Emission is an alpha channel + mipmaps. So the emission will be less size in video memory. This is very important for video cards and gbuffer.
Even if a glow map will be grayscale, so video card will convert it to rgb anyway.
In professional games which i reaped (DXReaper) i did not see one big rgb/grayscale texture for illumination. I saw only diffuse/normal maps with alpha channels.
Glow being rgb has it sense. Since i often let white stuff glow in blue or similar.
I think we should keep the core materials as basic as possible. So they can do everything but no special need optimizations.
As I said before. In professional games you will not find entire rgb texture for glow. Often itās used with diffuse texture and alpha channel.
as i suppose: glow color = diffuse.rgb * diffuse.a - so you will get the glow color.
@mifth: The issue is that diffuse map alpha is already used for transparency in jME3. The normal map alpha is used for height, for parallax effect. The specular map alpha doesnāt seem to be used for anything, so maybe that can be used for glowā¦
Also, GPUs will generally convert all grayscale/RGB images to RGBA format, since that is what the hardware is designed to handle best. So generally using grayscale images only helps as far as file size goes.
Thanks for your answer. I would try to reply:
You can use alpha channel for any needs using #def boxes. Not only for parallax and alpha.
I did alpha with just boolean checkbox for diffuse alpha channel:
[java]
#if defined (ALPHA_A_DIF) && defined (DIFFUSEMAP)
alpha = DiffuseSum.a * diffuseColor.a;
#else
float alpha = DiffuseSum.a;
#endif
[/java]
And for parallax map my proposal is:
[java]
#if defined(PARALLAXMAP) || defined(PARALLAX_A_NOR)
float h;
#if defined (PARALLAXMAP)
h = texture2D(m_ParallaxMap, texCoord).r;
#elif defined (PARALLAX_A_NOR) && defined (NORMALMAP)
h = texture2D(m_NormalMap, texCoord).a;
#endif
float heightScale = 0.05;
float heightBias = heightScale * -0.5;
vec3 normView = normalize(vViewDir);
h = (h * heightScale + heightBias) * normView.z;
newTexCoord = texCoord + (h * -normView.xy);
#else
newTexCoord = texCoord;
#endif
[/java]
So in such a way we can use different things for alpha channelsā¦
PARALLAX_A_NOR
ALPHA_A_DIF
SPEC_A_NOR
SPEC_A_DIF
REF_A_NOR
REF_A_DIF
So, thatās will be like a constructor for any purposesā¦
I know about rgayscale to rgb conversion. But the main idea is to save video memory. Just imagine the whole 2048x2048 texture + mipmaps (up to 1 pixel) for tiny lights. It's no good to ude video card memory in such a way.
LightBlow Shader updates:
- LightMaps are added.
- Minnaert bump mapping fixing.
Also I added new shader called FakeParticleBlow.
http://code.google.com/p/jme-glsl-shaders/
Hi!!! My Shader update!!!
Now you can test it with mercurial. JMP Project: hg clone https://paulgeraskin@code.google.com/p/jme-glsl-shaders/ jme-glsl-shaders
Iām going to make JMP plugin and put it to JMP Repository. I think the shader is good for production.
@mifth: Iām impressed and appreciated your contribution, believe that you do it with all with your afford and passion man! Iām definitely going to use it in my game!
Do you think some improvements and changes of the SDK Material Plugin may be made to fit some advanced technique used in Multi-pass Material (like grass and fur) and also water material ? Tell me if you interesting, we can work together on that?
@atomix Iām very interested in shader improvements and new features!!! You are welcome to ShaderBlow. I can add you to the development project if you like.
I want to make this library as a JMP plugin. But I donāt know how yet.
Iām donāt think your shader āhas to beā a plugin, it can be an official custom asset!
We can improve official Material Editor plugin to deal with some extra-features growing in Shader areaā¦
The first one is I really want to integrate :
- water (and other reflect material) in TextureEditor so we can test and make diffirent sort of water (ocean water, lake water)
- and then some Muti-pass Material like Grass, Fur
- animate Material like your FireShader
P/s : An āApply to selected Meshā Button in Material Editor will be neatIām really want it!
The material editor supports all properly written jme3 shaders as long as they are part of your assets. The plugin should simply have template files for those shaders. You can either create a wizard that pops up or you can simply provide files that can be added via the āNew Fileā. Both can be done with the existing templates for āModule Developmentā.
Edit: āApply to selected meshā doesnāt really make sense, you canāt select a model while editing the material, it represents a j3m file after all. There is a dropdown on each geometry to select a j3m file to apply.
@normen: Yeah, I know that āApply to selected meshā is quite dumb but it make a quicker visual change if neededā¦
AJ3m can be load into a selected mesh so make two steps become one quick step for lazy artist! In the future, do you think viewing a material which belong to some meshes change āon the flyā is cool. So it just the reference job after allā¦
atomix said:
- water (and other reflect material) in TextureEditor so we can test and make diffirent sort of water (ocean water, lake water)
You know there is a Filter editor now right?
You can edit the water there.
@normen: About the āmulti-passā material iām talking about it not just about shader⦠Like in a grass material, it have a lot of layers have the same shader render over and over again⦠May be this is too much for a Texture Editor but I still think we need it some howā¦
Guys, one thing I wanna say about post filter with cartoon edges.
@chototsu wrote post effect CartoonEdges.
chototsuās post effect - 2400 fps.
JME post effect (CartoonEdge filter post processor) - 1100 fps.
Scene consists one character.
So, possibly you will be interested in chototsuās post filter for cartoon edges. Thanks to him.
There are 2 examples in ShaderBlow. JME and Chototsuās. Have a try.
The method of one reflect able mesh == one filter not really convince me.
I still want :
any Mesh wear
any Material which have
Reflect-able Texture which tie with
Reflect-map Provider
can be test in Material Editorā¦(You can see the sane things work in UDK)
So, in the Material Editor we supply a default Reflect-map Providerā¦
In scene Composer:
Each Mirror have its own Reflect-map Provider, which can be choose or auto-gen.
Each Lake have its own water-color
Every Road can have the same provider for the performance-saving
Itās kind of weird but I still believe they can work that way