Misc FAQ

Here are some questions/answers I’m compiling. I’m not sure if the xith FAQ would be a better place to put it since it would just clog up the FAQ section, so I am putting them here for now. Hope it helps.

1. How do you set whole mesh transparencies? (I want to make my monsters fade away when they die!)

You’ll need to set Transparency Attributes on the mesh’s appearance and the material’s color target.
To make objects fade away, just change the transparency value during your render loop.

      ta = new TransparencyAttributes(TransparencyAttributes.BLENDED, 0.1f );
      mat.setColorTarget(Material.DIFFUSE);
      app.setTransparencyAttributes(ta);

2. How do you use alpha maps? (How do I use a saw I created that uses textures instead of polygons to show the teeth details?)

This is one way of doing it. You will need to load a texture file that supports the alpha channel. The best format for this is PNG. Load the texture as an alpha texture and set it to the object’s appearance. Then, set transparency attributes to the appearance.

          app.setTexture(TextureLoader.tf.getAlphaTexture(filename));
          ta = new TransparencyAttributes(TransparencyAttributes.BLENDED, 0.0f );
          mat.setColorTarget(Material.DIFFUSE);
          app.setTransparencyAttributes(ta);

3. How do you render everything as wireframe?

Set the RenderOptions’ wireframe option to true for the canvas peer.

        ro = new RenderOptions();
        ro.setOption(Option.ENABLE_WIREFRAME_MODE, true);
        cp.setRenderOptions(ro);

4. How do you render just one particular model as wireframe?

Get the model’s appearance and set its appearance’s polygon attributes.

        Appearance temp = sh.getAppearance();
        PolygonAttributes pa = new PolygonAttributes(
                PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0f);
        temp.setPolygonAttributes(pa);

5. How do you display an image icon over a character?

Use a Billboard and an appearance to create a new shape which can be made a child of the
character’s branchgroup. Apply the image as a texture to the appearance. A Billboard ensures
that the image is always pointing to the camera.

6. What is a Vertex Shader? How do you use a Vertex Shader in Xith?

A Vertex Shader or Vertex Program is essentially a graphics processing function that lets you change properties of a vertex such as position and color. This can allow you to do deformation, morphing and many other interesting effects. This processing is done by the hardware alleviating the burden on the CPU. To use one in xith, you’ll need to open your vertex shader and parse it into a String. Then use that string and set it as the appearance’s vertex program.

      appearance.setVertexProgram(new VertexProgram(strVertexShader));

you can create a new FAQ if you like.

This kind of stuff is better kept in the wiki IMHO – easier to find. We can link to this new FAQ in the docs section.

If you want to keep it as a thread, no probs – we can link to it in the “InterestingThreads” wiki page.

If you tell me your username, I can make you an editor so you can add FAQ questions.

Cheers,

Will.

I sent a PM. My username is the same: LaLiLuLeLo

You are now an editor at xith.org.

On the current FAQ page: http://xith.org/tiki-view_faq.php?faqId=1

Click “List FAQs”.

I have created a new FAQ for you to use named “Xith3D tips”. Please let me know if you have any problems.

Will.

Thanks. I was able to add the questions to the FAQ.

http://www.xith.org/tiki-view_faq.php?faqId=3

Good stuff.

I’ve added some stuff about JFrames and JPanels.

If you go here: http://xith.org/tiki-list_faqs.php
You should see a list of pending questions (in the brackets).

Feel free to encourage users to submit their own Q and A’s, keep an eye on that page and approve the good ones.

Will.

[quote]Good stuff.

I’ve added some stuff about JFrames and JPanels.

If you go here: http://xith.org/tiki-list_faqs.php
You should see a list of pending questions (in the brackets).

Feel free to encourage users to submit their own Q and A’s, keep an eye on that page and approve the good ones.

Will.
[/quote]
Could you make that page more “user-friendly”? By that I mean have like a list of the available FAQs in a left column or something with the main one (currently displayed) highlighted. I think users won’t click the little “List Faqs” box because they’ll think they’re looking at the only FAQ, I certainly never noticed that box until you just linked directly to it.

already done: http://xith.org/Docs

Will.