Need help with shader program

I understand that JME’s inPosition means the position in model’s surface. Am I right?
I also understand that some values I need to pass from vertex to fragment shader.

What I need to do: having position I am able to move it a bit (with some vector I can calculate) and then I need to take the value from the texture. Now I need to translate the new position to texture coordinates (using UV).
I cant do that just by taking inTexCoord, moving it by some vector and taking texture2D(m_MyCustomMap, texCoord).r because of UV mapping.

I know how to write what I need in shader (it’s just a c++ like programming) but I dont’t know all names, variables and functions the GLSL/JME provides. I was trying the google, but no success.

Maybe try searching the wiki instead of google:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:jme3_shaders

Ok, correct me if i messed something:

I must pass g_WorldViewProjectionMatrix from vertex to fragment shader, using for example
[java]
varying vec4 wwpm;
varying vec3 curPos;

wwpm = g_WorldViewProjectionMatrix;
curPos = inPosition;
[/java]

and in fragment shader:

[java]
vect3 result = curPos + someVector;
vect4 newTexPos = wwpm * vec4(result , 1.0);
float valueINeed = texture2D(m_MyCustomMap, newTexPos.xy).r;
[/java]

??

I don’t think you’ve adequately explained what you are trying to do. For example, I still don’t know what you’d want to transfer the world view projection matrix to the frag shader. It doesn’t normally have any model coordinates that would need transforming into view space so I don’t know why you’d need it.

Take a step back and tell us at a higher level what you are trying to accomplish as it sounds like you may have already painted yourself into a strange corner.

Also since g_WorldViewProjectionMatrix is a global uniform you can directly declare in as an uniform in the frag shader and use it. You don’t have to pass it as a varying from the vert shader to the frag shader.

But as Paul said…What do you exactly want to do?

Ok, my mistake with that global…

In the most simple words: I needa formula used to calculate inTexCoord. As fas as I understand, inTexCoord = f(somePosition)
I need f and somePosition to manually manipulate somePosition and calculate inTexCoordNew = f(someManipulatedPosition).
I cant manipulate inTexCoord because of UV mapping, must use it’s source.

Can you tell us what you are actually trying to do instead of just the low level mechanics that you think will solve it?

I’m trying to write some smooth shadow mechanism for very specific 3D environment.