How to create a semi-transparent dense (filled or solid) 3D object.

edited May 2014 in How To...

When I create a 3D object like a box, processing seems to create a surface defining an object (i.e., if you create a cube it is constructed by six square faces) instead of creating a dense (solid or filled) object. However, is it possible to crease a semi-transparent dense object?

So if we create an elongated semi-transparent dense box, the occupancy of the box is higher if we look at it in the direction of elongation compare to if we look at it in the direction perpendicular to the elongation. (where as if we just simple create a semi-transparent box, we have the same occupancy no matter which direction you look at it as it is just the surface of the box and empty inside...)

Thank you very much for your advices.

Tagged:

Answers

  • edited May 2014

    you can use fill with a lower alpha

    fill(v1, v2, v3, alpha)

    is fill (r,g,b,opacity);

    try

    fill (r,g,b,50);

    but that is not a filled object, but worth a try

  • Thank you very much for your suggestion Chrisir.
    I have tried it following your suggestion but it seem to only fill the surface hence the same occupancy looking from every side...

    so this question is still open...

  • Answer ✓

    visualizing an object by drawing its surface is the basic principle behind 3d in processing/opengl. the only idea i have concerning how to get a more solid box is filling it with lots of smaller boxes.

  • Thank you for your comment mschi.

    I guess if it is the basic principle of OpenGL there is no much hope... Right now I am mimicking the effect by stacking cubes to the direction of elongation, so that it will have proper occupancy when seen from the right direction; however, it almost gives the feel of a "pixel art"... I guess I can go even further like mschi has suggested to fill the box with small boxes I will see how it happens but right now I already have 0.5M cubes so could quickly hit the computational bottleneck.

    I am still open for some more suggestions/comments!

  • there is the concept of fog in opengl, but i'm not sure it that's available through processing. it kind of sounds like it'll do what you want, although it does seem to be based on distance from the viewpoint rather than thickness of the object.

    http://www.opengl.org/sdk/docs/man2/xhtml/glFog.xml

    "Fog blends a fog color with each rasterized pixel fragment's post-texturing color using a blending factor f. Factor f is computed in one of three ways, depending on the fog mode. Let c be either the distance in eye coordinate from the origin (in the case that the GL_FOG_COORD_SRC is GL_FRAGMENT_DEPTH) or the current fog coordinate (in the case that GL_FOG_COORD_SRC is GL_FOG_COORD)."

  • Thank you Koogs, I think it is fairly close to what I want to do.. just have to find a way to locally create fog in the cube.

    In fact I made a contact to a person working for the Graphics Lab at the university today and got this as an answer: http://http.developer.nvidia.com/GPUGems/gpugems_ch39.html

    I will dig bit into fog but I may need to look into volume rendering... which may be beyond the scope of processing or? Does anybody know of using volume rendering in Processing??

Sign In or Register to comment.