Skip to main content

About rendering translucent surface

14 replies [Last post]
jeana78
Offline
Joined: 2007-06-14
Points: 0

The surface is built from many lines, with TriangleArray objects for the interpolation between two lines:

http://ahmadjean.free.fr/Java3D/translucency/01/lines.png
http://ahmadjean.free.fr/Java3D/translucency/01/mesh.png

By using classical Transparency parameters (the transparency mode is BLENDED, the blend function for the source is
BLEND_SRC_ALPHA and the blend function for the destination is BLEND_ONE_MINUS_SRC_ALPHA) and whatever the VIEW
transparency sorting policy, I get:

http://ahmadjean.free.fr/Java3D/translucency/01/shape.png

So, the surface is not completly smooth and the lateral view of the curved areas (most brilliant shapes) looks strange.

Any ideas to have a more uniform result?

Note: I can't use QuadArray (the points are in a non-planar geometry) and the use of TraingleStripArray don't change the result.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
darwinjob
Offline
Joined: 2004-11-16
Points: 0

> The conclusion is there is no
> high level solution to support correct translucency
> rendering.

I would wait with a conclusion like that. You are getting these artifacts because of the topology of your mesh. If you find a way to fix the "creases" - the rendering will look much better.

I believe you're visualizing the magnetosphere affected by the solar wind... right? :) May I ask you how you calculate the lines for interpolation?

> Moreover, do you know why the images in the first
> post, obtained by an offscreen canvas and writes with
> an ImageIO
> object in the PNG format, don't look like those
> obtained on the screen ?

I don't :) But I have the same issue.

jeana78
Offline
Joined: 2007-06-14
Points: 0

By respect for physics, I'm not going to show you the result of SCREEN DOOR with the z-buffer disabled.
But thanks aces, I appreciate your replies.

Right your are darwinjob, I'm visualizing the magnetosphere with data from a numerical model. That's it,
the earth magnetic field exist everywhere in the space, so the more artefcts I get the less results I can show.
I also thought to smooth the surface, but this leads to the question of what information is hidden in a
visualisation problem of real data and don't solve some problems like for shapes_nok.png

So, I'm going to try shaders but Java3D is interesting because of the abstraction of programming.

Jean

darwinjob
Offline
Joined: 2004-11-16
Points: 0

>magnetic field exist everywhere in the
> space

Before you get into the nice world of shaders... Maybe building of isosurface with Marching Cubes (or Tetrahedrons) algorithm is worth to try?

BTW by using isosurface you would resolve the question of what information is hidden in a visualisation - you could build an isosurface for particular (tesla?) value or have it as a dynamic parameter.

Message was edited by: darwinjob

jeana78
Offline
Joined: 2007-06-14
Points: 0

For now, there is no interpolation of the input data. In the presentation of lines, I chose a low sampling to allow you to understand the context, in the others view there is a higher sampling of the model.
You must imagine many isosurfaces in the 3D space, and I have an implicit information to build them.

Jean

jeana78
Offline
Joined: 2007-06-14
Points: 0

posted below

Message was edited by: jeana78

wyldstal7
Offline
Joined: 2010-01-11
Points: 0

Hi jeana,

Could you tell me how you managed to get the transparency working?
I am trying to create a smoke like effect but I am unable to make it translucent.

Any help would be appreciated.

-stal

darwinjob
Offline
Joined: 2004-11-16
Points: 0

You could try to play with Shininess and Specular color. It might improve the results.

You might also rethink the way how the normals are generated...

jeana78
Offline
Joined: 2007-06-14
Points: 0

Hi,

I have split the geometry, now each triangleArray between two lines are subdivides into many triangleArray of 6 vertices:

http://ahmadjean.free.fr/Java3D/translucency/02/shape_split.png
http://ahmadjean.free.fr/Java3D/translucency/02/shape_before.png
http://ahmadjean.free.fr/Java3D/translucency/02/shape_after.png

So, the rendering of the depth of the shape seems more correct (Surrounded in red). But the first problem describes
is still alive (showed by the arrows).

I chose a high sub sampling to be close to the best rendering, believing that the only counterpart is the increasing of computations.
But there are new problems. The geometries are dynamically updated, with the use of the removeAllGeometries method
to clear the geometries of a Shape3D object, when data are changed. The first problem is that the update of
geometries don't work anymore, I get "java.lang.OutOfMemoryError: Java heap space" until "Could not create the Java virtual machine."
by increasing the heap space with Xms and Xmx options.

Another problem is that the rendering of two close shapes, but without overlapping, is strange:

http://ahmadjean.free.fr/Java3D/translucency/02/shape_1.png
http://ahmadjean.free.fr/Java3D/translucency/02/shape_2.png
http://ahmadjean.free.fr/Java3D/translucency/02/shapes_nok.png

I have thought that those rendering problems are linked to the precision of the z-buffer, but the reducing
of the distance between the back clip and the front clip to the maximum change nothing.

Note: The normal computed for a vertex is the normalized sum of the normals of the adjacent triangles.

Yours knowledges in Java3D or 3D graphics are welcomes.

Jean

Message was edited by: jeana78

aces
Offline
Joined: 2003-07-17
Points: 0

Amazing images !

There is the SCREEN_DOOR transparency mode, which is kind of OIT . It doesn't look good on some video cards, but is an option to try.

>... the update of geometries don't work anymore, I get "java.lang.OutOfMemoryError: ...

You can try update your current indexed geometry coordinates and normals using setCoordinates/setNormals, instead of creating new objects. It avoids new shapes, new bounds, nodes, etc.

weiland
Offline
Joined: 2005-08-05
Points: 0

One more thing you can do - use by-reference coordinates etc, define a GeometryUpdater in which to perform the updates, and update them yourself in-place. AFAICT, that's the most memory-efficient way to do it, if the other approaches don't work.

There's an example in the source code for this project (done by Martin Barbisch):
http://www.vis.uni-stuttgart.de/javatevi/

Bill

jeana78
Offline
Joined: 2007-06-14
Points: 0

The rendering with the SCREEN_DOOR transparency mode on a Quadro FX with full support of OpenGL 3.2 specifications is:

http://ahmadjean.free.fr/Java3D/translucency/03/shapes_screen_door.png

So, the depth of the shape disappeared and there is a new kind of artefact. The conclusion is there is no high
level solution to support correct translucency rendering. The DirectX 11 OIT looks very intersting
but requires to buy a new recent video card. I learnt that there is another technique called Depth peeling
which brings the correct rendering but requires heavy computations, those solutions require
the use of shaders :s

Moreover, do you know why the images in the first post, obtained by an offscreen canvas and writes with an ImageIO
object in the PNG format, don't look like those obtained on the screen ?

Thanks for your propositions to update the geometries, but the behavior of removeAllGeometries is not one that is expected.

Jean

aces
Offline
Joined: 2003-07-17
Points: 0

Screen_door is a kind of fake transparency. You must explicitly disable ZBuffer writing :

renderingAttributtes. setDepthBufferWriteEnable(false);

Play with transparency level until you find a good looking one

There is presentation about OIT, which explains implementation of "Dual Depth Peeling" and "Weighted Average". The later is simple but also requires shaders programming. Both methods are described in an Bavoil & Meyrs article, "Order Independent Transparency with Dual Depth Peeling", available at nvidia website.

The implementation article:
http://www.slideshare.net/acbess/order-independent-transparency-presenta...

aces
Offline
Joined: 2003-07-17
Points: 0

Hi

From Javadoc :
[i]
TRANSPARENCY_SORT_GEOMETRY (...) Note that this policy will not split geometry
into smaller pieces, so intersecting or intertwined objects may not be sorted correctly. (...)
[/i]

Also [i]"Transparency Blending is an order-dependent operation that requires sorting objects before rendering them." (*) [/i]
There is a technique called "order-independent transparency (OIT)" which doesn't requires pre sorting, but it is low level, no simple, and not all video cards support it.

The best approach is to split your large, monolic, geometry into small geometries ( not so small, tough) and let TRANSPARENCY_SORT_GEOMETRY does the sorting job.
I guess you can put all (split) geometries into a single Shape3D instance.

(*) from Guru3D : http://www.guru3d.com/news/amd-ladybug-and-mecha-dx11-demo-download/

jeana78
Offline
Joined: 2007-06-14
Points: 0

Hi,

Thank you for your advices. The OIT thechnique seems very interesting but more difficult to implement. I'll try to split the geometry and I'll post the results.

Jean