hi
in my java3d game (pool game) I’d like to see the shade the balls on the pool.
Does anyone know how to render shading with java3d?
you can see my game at:
http://www.geocities.com/calzada_us/Billard3D/Pool.html
Regards,
FRanck
hi
in my java3d game (pool game) I’d like to see the shade the balls on the pool.
Does anyone know how to render shading with java3d?
you can see my game at:
http://www.geocities.com/calzada_us/Billard3D/Pool.html
Regards,
FRanck
um, i don’t use java3D, but if it’s anything like OpenGL all you need is to create a point light source and enable lighting, and Lambert’s-Law diffuse shading with be automatic. However, the balls would still not cast shadows in the table, they would only be shaded themselves. Or you could create a specular light source for each ball.
To shade you must always:
have a material
the object must be lighted
To shade if you use textures use either:
TextureAttributes.MODULATE
or
TextureAttributes.BLEND
Hope that helps
Well,
actually I wasn’t clear on my needs.
What I need is to have the shadow of the ball reflected on the table. I learned that java3d didn’t support it for many technical reason, that makes sence. but I was wondering if someone developed something related to that.
Regards,
Franck
If you know the position of the balls and lights you can darw fake shadows (black circles over the table). The geometry of these shadows needs to be updated every time a ball changes its position.
Using a bit of trigonometry you can get approximated bounds for the shadows, but seeing your app, I don’t think you’ll have problems with that.
Rafael
I already thought about it. But I didn’t want to re-invent the wheel.
Looks like I have to…