Simple Parallax Mapping for Unshaded Material

Hi guys,

I have a request to someone with good knowledge of jME Materials and GLSL Shader.
I think this feature could really benefit the community and people trying to do nice looking models in android.

I want an Unshaded Material that doesn’t require any form of light but takes a colormap and normal map and apply parallax effect on it.
Basically the following quote as discussed in this document:

This vertex shader looks very similar to the bump map vertex shader, but here we are converting the camera vector, instead of the light vector, to tangent space.

Can anyone of you that are GURU’s with shaders help me?

Bump/parallax/normals et c. are lighting effects so the requirement to have those effects without lighting is a bit contradictory :slight_smile:

Are your 100% sure, because if you have a look at that document it seems as if that guy wrote it to only make use of the camera.

Well, normal maps are a lighting effect. Parallax mapping is a texture coordinate displacement effect. You don’t actually need a lighting vector at all for that one… JME already has a view vector in tangent space in the case of parallax.

Just look at how vViewDir is calculated and work from there, I guess.

Cool, but which current shader should I look at to use as basis?

@ndebruyn said: Cool, but which current shader should I look at to use as basis?

Take a look at Lighting.j3md, just to see how Common/ShaderLib/Parallax.glsllib is being used. You should be able to reuse that code directly.

Thanks for the reply, I will give it a try.
It is very difficult for me because I can get a proper understanding of shaders, but I will try.

pspeed said: ...Parallax mapping is a texture coordinate displacement effect.

I stand corrected :slight_smile:

Not sure how parallax mapping will look without lighting though…

Yeah I don’t know either. Will have to test it.

But how else will one get that effect on an android device with decent frame rates?

I generally try to avoid lighting on android.

An alternative solution for andorid would involve materialized textures
Eg create one base texture, and then the textures for from above, from below, from right, from left wich display a prerendered/materialized paralax effect.

Then blend between those textures based on view direction.
Might give a look alike effect for most cases, without the processing overhead.
(The 3 parallax versions could be lower res, and always blend the base texture with at least 0.5, to mask the lower effect resolution)