parallx-mapping in 1.7

Horray 1.7 is out! One of the new features I’m realy interested in is the parallax-mapping support.

If i got it right, a parallax map is an b&w image that specifies the height of the surface, similar to a displacement map and can be used in addition to a normal-map.

How should we apply such a map to our geometry, should we use a new texture for that? (or should we put it in the alpha-channel of the normal map (i did that before when doing some models for ogre-engine)?)
And most important: how would i export such a map from maya, or should i just modifie exportet eggs and write in the parallax map…how?

greetingz!

Hi,

Check out this manual page:
panda3d.org/manual/index.php/Texture_Modes

thx rdb, that helps allot…but…

another 2 question regarding normalmaps/parallax:

1: I specify the used normalmap in the egg file (and put the parallax into the alpha), so the texture is already loaded, when i create the actor (but the alpha isn’t i guess). Is there a way to “get” the applyed Normalmap from my actor-node and then re-apply it together with the parallax-alpha-map without knowing the texture name/lokation? Or even better: can i tell panda to recognise if there is an alpha in my normalmap file and then apply it as parallax-map???

The problem is i dont want to specify every parallaxmap-name/path for every actor in my code but in the egg file…

or can i simply change the part in the egg-file where the normlamap gets applyed? from

<Texture> phong1SG.tref1 {
  "bg_n.jpg"
  <Scalar> format { rgb }
  <Scalar> wrapu { repeat }
  <Scalar> wrapv { repeat }
  <Scalar> minfilter { linear_mipmap_linear }
  <Scalar> magfilter { linear }
  <Scalar> envtype { normal }
}

to

<Texture> phong1SG.tref1 {
  "bg_n.jpg"
  <Scalar> format { rgba }
  <Scalar> wrapu { repeat }
  <Scalar> wrapv { repeat }
  <Scalar> minfilter { linear_mipmap_linear }
  <Scalar> magfilter { linear }
  <Scalar> envtype { normalheight}
}

tryed it but it dont works, cause “normalheight” is unknown… is it possible that way with the right “keyword” ;D ???

2: is there a way to turn normalmapping off (in config or in code)…need this as option in my game for the not so fast machines… (i cant just not call “setshaderauto” because i may need it for the shadows…)

thx for your help!!!

edit: and another question:
3: is it possible to specify the specular color of my model via texture?

edit2: i tryed to apply a parallaxmap as shown in the manual like:

m=loader.loadModel("ob.egg")
tex = loader.loadTexture("testpara.jpg")
ts = TextureStage('ts')
ts.setMode(TextureStage.MHeight)
m.setTexture(ts, tex)
m.setShaderAuto()
m.reparentTo(render)

the model has a normal/specular/gloss/glow and diffuse map specified in the egg file and is loading/rendering correct without the parallax but if i try the code above i get following error:

:gobj(error): created-shader: (22) : error C5102: input semantic attribute “TEXCOORD” has too big of a numeric index (8)
:gobj(error): created-shader: (23) : error C5102: input semantic attribute “TEXCOORD” has too big of a numeric index (9)
:gobj(error): created-shader: (25) : error C5102: output semantic attribute “TEXCOORD” has too big of a numeric index (8)
:gobj(error): Shader encountered an error.
:gobj(error): created-shader: (22) : error C5102: input semantic attribute “TEXCOORD” has too big of a numeric index (8)
:gobj(error): created-shader: (23) : error C5102: input semantic attribute “TEXCOORD” has too big of a numeric index (9)
:gobj(error): created-shader: (25) : error C5102: output semantic attribute “TEXCOORD” has too big of a numeric index (8)
:gobj(error): created-shader: (21) : error C5041: cannot locate suitable resource to bind parameter “l_eyevec”
:gobj(error): created-shader: (25) : error C5041: cannot locate suitable resource to bind parameter “l_binormal”

what am i doing wrong?

  1. Use the “normal_height” keyword. That’s what the Bump Mapping sample program uses, too.

  2. I don’t think so, except that you can (1) disable the shader generator entirely or (2) disable parallax mapping by setting the amount of samples to 0.

  3. Not aware of any, sorry.

As for those errors, did you upgrade to the official 1.7.0 release? I fixed a couple of things related to that.

thanks again rdb for your great help, yes i upgraded to the official 1.7 release… gonna do some further testing, maybe with a simpler model…

edit: i tried it with my old model and still got these errors, but then i tried with another, fresh exportet model(just a simple sphere) and it worked! GREAT!

Sorry if this is already answered, or covered elsewhere.
I’m trying to get heightmaps to work in 1.7.0, but am having…issues.
Is there any reason why this would not work?

<CoordinateSystem> { Z-Up }

<Texture> Tex3 {
  "skins/Copy of standard/male_basic_refl.png"
  <Scalar> format { alpha }
  <Scalar> wrapu { repeat }
  <Scalar> wrapv { repeat }
  <Scalar> minfilter { linear_mipmap_linear }
  <Scalar> magfilter { linear }
  <Scalar> envtype { gloss }
}
<Texture> Tex2 {
  "skins/Copy of standard/male_basic_bump.png"
  <Scalar> format { rgba }
  <Scalar> alpha-file {"skins/Copy of standard/male_basic_height.png"}
  <Scalar> wrapu { repeat }
  <Scalar> wrapv { repeat }
  <Scalar> minfilter { linear_mipmap_linear }
  <Scalar> magfilter { linear }
  <Scalar> envtype { normal_height }
}
<Texture> Tex1 {
  "skins/Copy of standard/male_basic.png"
  <Scalar> format { rgb }
  <Scalar> wrapu { repeat }
  <Scalar> wrapv { repeat }
  <Scalar> minfilter { linear_mipmap_linear }
  <Scalar> magfilter { linear }
  <Scalar> envtype { modulate }
}

If I put a straightforward “normal” in tex2 the mesh works fine, but as it is I get odd sort of reflections on the bump-mapping.
Is it perhaps the case that normal_height and gloss dont play well together?
I’m probably missing something very obvious but cannot for the life of me see it.

Edited cos I had argb not rgba. That wasnt what stopped it working though…

I’ve noticed that both in pview and in the game the object(s) are in, if I turn off lighting, the heightmaps seem to work, it’s only with lighting on that I get the strange effects.
If it would help I can post screenshots…

So, top left, just the diffuse colour, as lighting and per pixel effects are turned off.

Top right,per pixel is on, lighting off. The heightmap gives depth to the scene, recessing doorways, making other bits stand out.

Bottom left, with both lighting and per pixel turned on, you get this. Viewed closer, you get weird reflections of the diffuse map appearing as if the whole thing were very shiny and very bumpy.

Bottom right, the same scene but with the heightmap removed, so only diffuse, gloss and normal maps are enabled, lighting and per pixel turned on.

I’ve tried setting up the “normal_height” combo in a rgba as in my first post.
I’ve tried separate “normal” and “height” rgb (which is actually the bottom right pic, height seems to be ignored).
Clearly I’m doing something wrong, but what?

And here we see the zoom into the third pic above, showing the strange reflection of the diffuse map:

  1. reflections not visible at this distance
  2. You start to see almost “interference” patterns on the flatter parts
    3.Now you can almost make out that it is a repeating pattern on the flat parts. On the bumpier bricks at the top the image is much more distorted.
  3. Zoom in close, and you can see the diffuse map (“modulate” in the egg file) is being reflected or tiled on in some strange way.

Does it help if you tweak the “parallax-mapping-scale” configuration variable? Try setting it to a small value, like 0.04.

Thanks. I tried that, changing to 0.0004 got me something close to working. I’ll play with that setting a bit, but I think that you have basically solved the problem for me.
Many thanks.