Quantcast

weird rendering issue

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

weird rendering issue

keith
I am not sure you are the right people to ask, but I am working my way down the software chain.

I am using the latest version of java3d, compiled on my machine (that has a NVIDIA graphics board) from maven.
        <jogamp.version>2.3.2</jogamp.version>
        <swt.version>3.8</swt.version>

On a NVIDIA graphics board everything works just fine. On an Intel or AMD board there are weird rendering artifacts. It seems to be that surfaces suddenly become see through. Walls do not hide what is behind them (in some spots), the ground does not hide what is below it (in some spots). Those spots change as the view point changes. Attached is a set of images to illustrate the problems. The problems.txt file describes the problems in each pair of files.

problems.txt
scsh1-circled.png
scsh1-good.JPG
scsh2_circled.png
scsh2-good.JPG
scsh3-circled.png
scsh3-good.JPG

This problem started (as far as I can tell) when we switched to Java 8.0, although that may be a false correlation. I used to use LWJGL and it had the same problem. I was hoping that converting to the modern java3d would fix it.

Any ideas?

Keith
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

gouessej
Administrator
Hi

In my humble opinion, it has nothing to do with Java 1.8, it looks like an OpenGL problem and as Java3D is based on OpenGL, it's affected too. You probably rely on an unspecified behaviour of Nvidia graphics cards. I advise you to look at the winding of the vertices in the affected models and their respective normals. You can disable the Java2D OpenGL pipeline if you think that it might affect Java3D. There seems to be something really wrong with your normals, I have found some other anomalies. Backface culling is probably enabled in your code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

Keith Willenson
That all makes sense, except for the part about relying on an unspecified behavior of Nvidia cards. Until recently, this code worked correctly on all graphics cards. I have older compiled versions of the code that still work correctly on all cards. Newer code is all non-3d features. I believe, and I could be wrong, that the only 3d changes are to make the code jogamp-java3d instead of lwjgl (but both behave in the same way) and a locally rolled version of com.jogamp.opengl.util.GLBuffers and com.jogamp.common.nio.Buffers.

I thought I turned back face culling off, but I will double check.

I will compare the old OpenGL code to the current OpenGL code and see if I can find differences. Also, I will look into the vertex winding and normal calculations.

Thanks,

Keith
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

gouessej
Administrator
How do you explain that it still works correctly with an Nvidia graphics card?

I advise you to make a SSCCE by using a tiny model. It would help to reproduce your bug and to understand what is wrong.

I hope that you don't put any JARs into the JRE.

You said that the problem occurred when you switched to Java 1.8, maybe it started picking the latest version of Java3D when you stopped using an older JRE.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

gouessej
Administrator
In reply to this post by Keith Willenson
You can export your faulty models into OBJ, Collada or STL so that I can load them and see what is wrong.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

keith
Here are the models as they were imported into the software. Also included are the sketchup original files that were exported to Collada. There is a file used_models.txt which lists the models used. https://mab.to/TBtEylQ2E

Here is a link to the files as they are exported from our software, including the whole site as a Collada model. https://mab.to/U2YWq5gmC

I'm not sure how these links will work, but if they don't let me know.

Keith
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

keith
This post was updated on .
In reply to this post by gouessej
I have no explanation about why it works with a Nvidia card (on multiple machines BTW). That totally confuses and frustrates me.

All jar files are local, nothing gets copied to the JRE. Actually all referenced jars are copied from the JDK to be local.

When we switched to Java 1.8 we were still using the old unmaintained LWJGL. It had the same problems. I was hoping Java3D would fix those problems. We needed to move to Java3D anyway, so no going back.

After loading each model, I went through all meshes and made sure everything was counter clockwise. I also recalculated the normal for each point. Also, I made sure each mesh and node had culling set to none. None of this made any difference in the drawing problem.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

gouessej
Administrator
Hi

I'm going to look at your models. Have you tried to open them in Blender? I use Intel and AMD graphics cards at home, I should be able to reproduce your bug.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

keith
Here is a better link. It includes each model separately. https://mab.to/SyzaOngwn 
I was able to load the entire site into Sketchup. I have not tried Blender. The original models are in 3D_Models, the site and house models are in Test_Virtual_3d.

Keith
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

keith
I thought this might help too. Here are the nodes that describe the site. I'm assuming you don't need my skybox.

I got them with

        Node[] save = new Node[] { ground, buildings, models };

        BinaryExporter binaryExporter = new BinaryExporter();
        for (Node node: save)
        {
          File f = new File(Setup.getApp().getSite().getFileName());
          String sitePath = f.getCanonicalPath();
          sitePath = sitePath.replace(f.getName(), "app_" + node.getName() + ".bin");
          App.diagnose("write " + sitePath);
          OutputStream os = new FileOutputStream(sitePath);
          binaryExporter.save(node, os);
          os.close();
        }

app_buildings.bin
app_ground.bin
app_models.bin
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

gouessej
Administrator
Sorry for the delay, I'll look at your models as soon as possible.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

keith
The original bin files I gave you had, faces set to no cull and an attempt at normalizing the faces. This caused problems in the working 3d version we have. Mostly the problem was flickering as two faces at the same location were drawn. I have removed both the normalization and forcing all faces to no cull. Here are the same bins.
app_buildings.bin
app_ground.bin
app_models.bin

I assume links in my older e-mails have expired. Please let me know if you want them recreated.

Keith
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

gouessej
Administrator
Maybe this explains your problem, some z-fighting caused by two faces at the same location. What is the remaining problem?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

keith
The remaining problem is that the models draw just fine on a NVidia card. On an Intel/AMD graphics card there are weird artifacts, the surfaces (sometimes) do not obscure things behind/underneath them. The original pictures I sent you of the problem are from unaltered models (the second set). Same models, same code, different graphics board. We have different graphics boards in the office and have not noticed a difference until recently.

What I'm saying in my previous post is that I tried to implement some of your suggestions, but they did not produce useful results. Perhaps the fault is mine in how I implemented them.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weird rendering issue

gouessej
Administrator
Ok I'll try to find some spare time to load your models. I'm very busy, I'd like to release JogAmp's Ardor3D Continuation 1.0.0 before the end of this year.
Loading...