[X3D-Public] Can I create a colored shape without any lighteffects?

Bederov, Sergey bederov at cortona3d.com
Thu Aug 6 08:44:39 PDT 2009


Hello Tomas,

> I didn't know about billboards, I googled them, but I and
> don't see how they would help me. (If I understood, billboard
> is A plane that rotates to always face the user.) Anyway, I
> get the specefication of the concentrations in the liquid as
> an XML output from a program and am using XSLT to create the
> visualization in X3D. This would mean that I would have to
> also generate the png textures by some tool.

Actually a billboard does not have to be a plane, it can be any other geometry. For example, it can be a box that always faces the user with one side.

Miriam's point was to create one PNG texture that is opaque in the middle and transparent at the sides, something like a blurred circle. You can represent each point of data with a Billboard that contains a square with this texture. The squares must be overlapping so that the combination of many circles appears continuous. To vary the color of each data point, you can assign a different color to each shape. If the PNG texture is 2-component (gray+alpha), then the Material's color will "see through" the texture.

Here is a small example. It uses a 2-component PixelTexture instead of PNG.

PROTO DataPoint [
    exposedField SFVec3f pos 0 0 0
    exposedField SFColor color 1 1 1
]{
    Transform {
        translation IS pos
        children Billboard {
            axisOfRotation 0 0 0
            children Shape {
                appearance Appearance {
                    material Material {
                        diffuseColor IS color
                    }
                    texture PixelTexture {
                        image 2 2 2 0xFF00 0xFF00 0xFF00 0xFF80
                    }
                }
                geometry IndexedFaceSet {
                    coord Coordinate {
                        point [-1 -1 0  1 -1 0  1 1 0  -1 1 0]
                    }
                    coordIndex [0 1 2 3]
                    texCoord TextureCoordinate {
                        point [.25 .25  1.25 .25  1.25 1.25  .25 1.25]
                    }
                }
            }
        }
    }
}
DataPoint{pos 0 0 0 color .6 0 0}
DataPoint{pos 0 0 1 color 1 0 0 }
DataPoint{pos 0 0 2 color 1 .4 0}
DataPoint{pos 0 1 0 color 1 0 0 }
DataPoint{pos 0 1 1 color 1 .4 0}
DataPoint{pos 0 1 2 color 1 .8 0}
DataPoint{pos 0 2 0 color 1 .4 0}
DataPoint{pos 0 2 1 color 1 .8 0}
DataPoint{pos 0 2 2 color 1 1 .2}
DataPoint{pos 1 0 0 color 1 0 0 }
DataPoint{pos 1 0 1 color 1 .4 0}
DataPoint{pos 1 0 2 color 1 .8 0}
DataPoint{pos 1 1 0 color 1 .4 0}
DataPoint{pos 1 1 1 color 1 .8 0}
DataPoint{pos 1 1 2 color 1 1 .2}
DataPoint{pos 1 2 0 color 1 .8 0}
DataPoint{pos 1 2 1 color 1 1 .2}
DataPoint{pos 1 2 2 color 1 1 .6}
DataPoint{pos 2 0 0 color 1 .4 0}
DataPoint{pos 2 0 1 color 1 .8 0}
DataPoint{pos 2 0 2 color 1 1 .2}
DataPoint{pos 2 1 0 color 1 .8 0}
DataPoint{pos 2 1 1 color 1 1 .2}
DataPoint{pos 2 1 2 color 1 1 .6}
DataPoint{pos 2 2 0 color 1 1 .2}
DataPoint{pos 2 2 1 color 1 1 .6}
DataPoint{pos 2 2 2 color 1 1 1 }

                                           Sergey


More information about the X3D-Public mailing list