Procedural objects & shaders

OK, I added a procedural square to the Normal map tute room, and got
the following strange behaviors:

  1. bumpMapper.sha works, but not ShaderAuto (get a wierd diffuse
    color that looks like the addition of color & normal maps, and no
    bumpmapped shadows)

  2. procedural square alone does NOT work if the abstractroom
    is not loaded (diffuse color OK,
    but no bumpmapped shadows, AND point light now has hard edges).

  3. procedural object with colors and shadows DOES work if models/abstractroom is loaded with the procedural square.

I want to build a procedural room, and use procedural shaders
(seems like everybody is jumping on the procedural bandwagon
these days), but I can’t test it with the autoshader, and I can’t
build a room without loading a model.

I should note that I added color and normals to the square thus:

squarecolor = loader.loadTexture(“cobblestonesDiffuse.tga”)
tscolor = TextureStage(‘tscolor’)

squarenormal = loader.loadTexture(“cobblestonesNormal.tga”)
tsnormal = TextureStage(‘tsnormal’)

Did you compute tangents and binormals for all of your vertices? In order to apply a normal map, you need to have this additional data.


OK, that worked. I found out how to add those from the Fractal
plants tute, and did the following. Is there an easier way?

tangentFormatArray.addColumn(InternalName.make("tangent"), 3, Geom.NTFloat32, Geom.CVector)
binormalFormatArray.addColumn(InternalName.make("binormal"), 3, Geom.NTFloat32, Geom.CVector)
format = GeomVertexFormat.registerFormat(format)
vdata=GeomVertexData('square', format, Geom.UHDynamic)

Incidentally, the documentation says it should be Geom.CVertex, but
there is no such thing. Geom.CVector works.

BTW, autoshader still doesn’t work, but bumpMapper.sha does.