problem with refraction?

Help
2015-08-24
2016-09-26
1 2 > >> (Page 1 of 2)
  • Nathan Ryan

    Nathan Ryan - 2015-08-24

    I have a scene with a water body that has a material with 1.33 ior. I also have 4 layer textures all overlay/bumps add. I have an object half in/half out of the water. There seems to only be a refraction effect in the shadows ,not where the object meets the water. I've tried going down to a single layer texture, taking out all the bump mapping, upping the ray depth, and lots of other things. Nothing seems to work. Using latest version just downloaded. I'm enclosing a pic and source file

     
    Last edit: Nathan Ryan 2015-08-24
  • Peter Eastman

    Peter Eastman - 2015-08-25

    It looks as if it's getting confused about which points are inside and outside the water. Strange...

    Peter

     
  • Nathan Ryan

    Nathan Ryan - 2015-08-25

    I used "thicken" to make the water body. I used the "hairy" script to create the object. Could there be some strange normals going on?

     
    Last edit: Nathan Ryan 2015-08-25
  • Peter Eastman

    Peter Eastman - 2015-08-26

    Yes, that seems to be exactly the problem! I did Mesh->Invert Surface Normals, and now the shadows look the way they're supposed to.

    Peter

     
  • Nathan Ryan

    Nathan Ryan - 2015-08-26

    On which object(s)?

     
  • Peter Eastman

    Peter Eastman - 2015-08-26

    Water4.

    Peter

     
  • Nathan Ryan

    Nathan Ryan - 2015-08-26

    i reversed the normals on the water body and the textures (front face only) disappeared. It also doesn't look right in the editing window. It now acts like the material is correct, but the textures are not normalized. I can work around for now setting both texture surface sides on. Something is still wrong.

     
  • Luke S

    Luke S - 2015-08-26

    I verified that there is no refraction taking place. Just place a cylinder half in, half out of the water, and render from an angle. This holds whether normals are reversed or not.

    The shadow thing seems to be picky about what angle it is viewed from, some angles its obvious, others, (Top, in my experiment) the shadows appear to render normally.

     
  • Peter Eastman

    Peter Eastman - 2015-08-27

    It's working fine for me. Here's an image showing that the textures are still there, and also that refraction is happening as expected. The only change I made to the water was reversing the surface normals.

    Peter

     
  • Nathan Ryan

    Nathan Ryan - 2015-08-27

    That looks right. I'll keep trying to get it. Could it be a mac vs. pc thing?

     
  • Peter Eastman

    Peter Eastman - 2015-08-28

    You mentioned above that the textures were applied to the front face only. But in the file you posted, they're applied to both front and back faces. It sounds like you may be working with something different from the file you posted?

    Peter

     
  • Luke S

    Luke S - 2015-08-28

    I did a little (more careful) testing last night. I'm on Windows 7, Java 8.

    • As posted, the file has proper refraction, but broken shadows.
    • With the water object normals inverted, Refraction is broken, but shadows are correct.

    my internet is slow right now, I'll try to post screenshots.

    EDIT: To clarify, I have done this experiment with both the windows installer (my build) and the generic AOI ZIP, 3.0.2. (Peter's Build) Both show the same results.

     
    Last edit: Luke S 2015-08-29
  • Nathan Ryan

    Nathan Ryan - 2015-08-30

    Thanks Luke. That's what I'm getting too. I did change the textures to be on both sides in the middle of entering the message (bad form I know) to see if it would change anything, but it didn't seem to help. There's also a slicing effect under water on the shadows and the objects. I thought it might be a bumpmap or displacement in the textures, but after taking those all out, the slicing effect was still there.

     
    Last edit: Nathan Ryan 2015-08-30
  • Pete

    Pete - 2015-08-31

    Hi.

    I had a look at it too. I increased the intensity of the light quite a bit to really start to see, what is happening. So:

    Starfish_as_is: Shadows are definitely wrong on the surface of the water. They are shiny! One thing that could be affecting the outcome is that there is an emissive component in the water texture .... I did not test.
    Starfish_water_inside_out: When the water object is with the surface inside-out, raytracer does not undestand refraction. That seems logical to me. As another effect the seabed turns partially dark. The camera angle may be a factor. -- This would need more systematic testing.
    Starfish_old_raytracer: Here I dug up an older version of Renderers.jar (actually it was the perspective hack, from a few generations back). Looks fine to me.
    Starfish_old_raytracer_no_bumps: Here I removed all the foam textures, removed bumps and made the surface more reflective. The 'slicing effect' is gone. One reaseon why the slicing may appear is, that the Turbulence module produces sharp edges to the bump map. -- I did not check if Noise would do any better.

    I at least tried to use the same rendering setting to all of those pictures, with the photon mapping, scattering, caustics.... Somehow the old raytracer was about 10% faster than the current one (!).

    Why I got curious in the first place was, that I stumbled into some strange behavior of the raytracer, when I was experimenting with the textures of the diamond... http://www.friendlyskies.net/aoiforum/viewtopic.php?id=2957 -- The textures are supposed to be physically correct, but there was a case, when the raytracer simply refused to render anything at all. I have been meaning to report that (and a few other things that happened), but it's still in the drawer....

    On the last mentioned picture you can also see a seam slightly left of the middle. That is because the image in the sky-texture is not mapped correctly. The trick is to force the 2:1 picture into 1 unit by 1 unit in the image module of the procedural texture.... A kind of strange, but that's how it works.

    EDIT 1: The sand turning dark happens with both of the renderer versions.

    EDIT 2: @Peter, did you use MonteCarlo GI? I used Photon Mapping on mine? I started a MC-render, but got bored of waiting. :) Though it looked somewhat alright, but with much less shadows ... And not inverted normals.

     
    Last edit: Pete 2015-08-31
  • Nathan Ryan

    Nathan Ryan - 2015-08-31

    Thanks a bunch, Pete. You've given me a lot to look at. It does seem that the bumps are causing the slicing effect (which I assume is the correct raytracing for that texture-need to work on the water surface texture). The strange shadows are still a mystery. The shadows look more "correct" with the older renderer.

     
  • Nathan Ryan

    Nathan Ryan - 2015-09-01

    I just had a theory. The slicing effect seems more pronounced where the shadows' edges are. I know bump mapping only shows up where there is light, so in shadows you don't see the bumps on the surface - they are effectively "erased" by the shadow. Bumps seem to affect the refraction however and that should be visible whether in shadow or light (I think). Could it be that the refractions (and maybe reflections) from bump height are being ignored in the shadows thus creating the artifacts at the shadow's edge? See Pete's attachment of Starfish_as_is.png for good example. I used photon mapping for lighting as well.

     
    Last edit: Nathan Ryan 2015-09-01
  • Luke S

    Luke S - 2015-09-01

    @Pete: You said:

    Shadows are definitely wrong on the surface of the water. They are shiny!

    Thats what I thought as well, but on closer examination it appears that:

    • The Surface normal in the shadow seems to act as if it is pointed straight at the camera.
    • Something wrong with the reflection specs.

    @Nathan: You said

    It does seem that the bumps are causing the slicing effect (which I assume is the correct raytracing for that texture-need to work on the water surface texture)

    Right. The bump map is creating a hard edge, for water you need it to roll over just slightly. Not quite sure how to acheive that. Every time I try to modify the output of a texture module, odd things happen.

    Bumps seem to affect the refraction however and that should be visible whether in shadow or light (I think).

    Should. All a bump map does is change the angle that a ray sees when it impacts a surface. It should refract from there. In this case, the shadows areas are showing the urchin under the surface as if the water was not there, no refraction. This would also be what you would see if the ray is runing into the surface at exatcly 90 deg. (straight in towards it.)

    Try reducing the transparency of the water texture. What are your conclusions?

     
    Last edit: Luke S 2015-09-01
  • Nathan Ryan

    Nathan Ryan - 2015-09-01

    @Luke so are you agreeing that there is a possible bug? The refraction and possibly reflection seem to be off when there is a bump map. I reduced the water texture transparency from .9 to .7 and it didn't seem to make a difference. But even if the transparency is 1.0 shouldn't the material still show its refraction? Also, the older raytracer version seemed to render the shadows correctly with bumpmap - Pete graphic: "Starfish_old_raytracer.png"

     
    Last edit: Nathan Ryan 2015-09-01
  • Luke S

    Luke S - 2015-09-12

    Sorry for the delay.

    @Nathan: Yes, I believe that there is a bug. I don't recall why i asked you to reduce transparency, other than that it seemed to make part of the issue more obvious. The refractive and reflective effects that you see in full light are, I believe, correct. Just the bits in shadow are not doing what they are supposed to.

    I've just done a bit of testing, and this bug dates back to at least 3.0 Have not been able to check further back as the file is not back-compatible. I'm going to try to build a simpler test scene, and test even further back. Hopefully, I will also be able to get even more... obvious visuals, as your scene (especially the urchin) is quite visually complex, and some of the bad bits look plausible.

    @pete you mentioned that you had some odd results with your diamond project. Could you post them, perhaps in teh diamond thread, so that we would have a chance to compare with the results that are happening here?

     
  • Nathan Ryan

    Nathan Ryan - 2015-09-12

    Ok Thanks Luke. I am also wondering if it has anything to do with the bad scripts repository in the last version. I may have used the thicken script from the bad script repository to make my water body and maybe that caused something. Just a thought. Really appreciate you looking into it.

     
  • Luke S

    Luke S - 2015-09-12

    Not sure what you mean by "Bad scripts in the last version," I'll see if I can duplicate the issue with a simpler scene, though.

    EDIT: have managed to show that this has nothing to do with the thicken script. I replaced your water object with a cube & converted that to a trimesh. Same issue.

     
    Last edit: Luke S 2015-09-12
  • Luke S

    Luke S - 2015-09-13

    Now I am completely stumped...

    I have not been able to duplicate this in another file, and that is freaking me out.

    Things I have duplicated:
    - Lighting conditions (ambient/environment/directional)
    - Objects inside a refractive trimesh
    - Texture (copied over from the original file)
    - Shadows cast by object that intersects water surface.

    Anything else that you can think of that might be relevant?

     
  • Luke S

    Luke S - 2015-09-14

    Finally got this duplicated.

    Minimal requirements for this to happen:

    • Transparent texture
      • Some specularity
      • Substantial Shininess. Exact ammount varies with transparency, More transparent = more shininess required (There also seems to be a floor for transparency, below which this will not happen)
    • Refractive material
    • Transparency and refraction must be applied to an object that is rendered as triangles, IE a mesh. Primitives do not exhibit this problem.
    • Shadow must be cast by an object rendered as triangles.

    Symptoms: in areas shaded from direct light,

    • Transmitted rays ignore all properties of the material that they go through, including colors and IR.
    • Diffusely reflected rays, including those that are children of the problem transmitted rays, seem to be handled correctly.
    • Specularly reflected rays seem correct (Have not yet included a bump map)

    This problem cropped up sometime after [r359] but before [r374]. Will have to do more sample compiles to narrow further.

     

    Related

    Commit: [r359]
    Commit: [r374]


    Last edit: Luke S 2015-09-14
  • Luke S

    Luke S - 2015-09-18

    I've got things narrowed a bit. This bug was introduced sometime during the refactor of the raytracer from the raytrace rendering functions, commits [r370] [r371] & [r373]

    It's a little tough to tell when, because 371 won't run without a groovy library (not in place when I revert to that commit) and 373 won't compile at all, also without the library. 370 has its own, much bigger, render issue, which seems to have been worked out in the meantime.

    I'm attaching here a screenshot & scene of a much simpler setup that will hopefully point in the right direction. Note:

    • The vertical cylinder, and both the cubes are all triangle meshes. For the upper cube, this does not seem to matter, but for the other two it does.
    • A spline mesh placed in the position of the upright will display the same issue.
    • Bump map added to the transparent texture will still render specular reflections correctly.

    Any thoughts?

     

    Related

    Commit: [r370]
    Commit: [r371]
    Commit: [r373]


    Last edit: Luke S 2015-09-18
  • Luke S

    Luke S - 2015-09-27

    Been running the raytracer through a debugger, and I'm a little puzzled. The issue does seem to involve normals, but I've run into a brick wall.

    The issue seems to be that artofillusion.Renderers.raytracer.RenderWorkspace.trueNormal[i]
    Seems to be given the wrong vector when the intersection point is not lit directly.

    My probelm is that I cannot find where these vectors are set. I see that every render workspace has this array initialized with a bunch of blank vectors, and suspect that the vectors are then mutated in another bit of code, but the only accesses that I can find are simple reads that do not mutate the object.

    EDIT: Okay, I see that RenderWorkspace.trueNormal[i] is set by passing it into RTTriangle.TriangleIntesection.trueNormal() But I still don't see how it is affected by direct light.

     
    Last edit: Luke S 2015-09-28
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks