We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Annotation issue with Ocean Rendering

Home Forums General Questions Annotation issue with Ocean Rendering

Tagged: ,

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #70030
    ps
    Participant

    Hi,

    I am using the Verge3D webgl_shaders_ocean example in a V3D App template to render ocean. Also I have some objects floating on the ocean and used annotations on them to identify it.
    There are issues with annotations when combined with ocean rendering, as it is not properly getting displayed in their respective positions. Upon adding the ocean, the annotations are not in their fixed positions and keeps moving based on camera movement.

    I have used the following code to render ocean
    Link: https://github.com/Soft8Soft/verge3d-code-examples/blob/master/webgl_shaders_ocean.html

    const waterGeometry = new v3d.PlaneGeometry(10000, 10000);
    
            water = new Water(
              waterGeometry,
              {
                textureWidth: 512,
                textureHeight: 512,
                waterNormals: new v3d.TextureLoader().load('textures/waternormals.jpg', function(texture) {
    
                  texture.wrapS = texture.wrapT = v3d.RepeatWrapping;
    
                }),
                sunDirection: new v3d.Vector3(),
                sunColor: 0xffffff,
                waterColor: 0x001e0f,
                distortionScale: 3.7,
                fog: scene.fog !== undefined
              }
            );
    
            water.rotation.x = - Math.PI / 2;
            scene.add(water);

    Also I have noticed that if the line water.rotation.x = – Math.PI / 2; is removed the annotations are properly displayed. But it makes the ocean vertical. Also refer the attached puzzle image for annotations.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #70036
    kdv
    Participant

    instead of
    water.rotation.x = -Math.PI / 2;
    try
    waterGeometry.rotateX(-Math.PI / 2);
    use it as the second line, right after const waterGeometry

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #70043
    ps
    Participant

    Hi @kdv
    Thanks for your reply.

    I tried adding the code in the next line after const waterGeometry

    waterGeometry.rotateX(-Math.PI / 2);

    But after adding, the reflections in the water appears to be stretched and the annotations are still not in their designated positions and moving along with the camera. Please refer to the attached image.

    Attachments:
    You must be logged in to view attached files.
    #70045
    kdv
    Participant

    Could you recreate the issue in a little less complicated app and share this app here?

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #70049
    ps
    Participant

    Please download the verge3d project from the link below

    Link: https://drive.google.com/file/d/1kpF6P07HHwm2Dp2EnZH7Ftx0q6s5g2-3/view?usp=sharing

    Refer the screenshot attached. Thanks.

    Attachments:
    You must be logged in to view attached files.
    #70054
    kdv
    Participant

    Consider using an alternative annotation system. It’s not so difficult given you already have CSS styles.
    https://v3d.net/smd

    https://drive.google.com/file/d/1fHAfPulsViVnu4xiPI63V_8IeHJ_3rP4/view?usp=sharing

    Something definitly wrong with the Annotation class in v3d.js. It can take a lot of time to figure out :unsure:

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #70087
    ps
    Participant

    Hi @kdv, Thank you very much for your help. I am able to create annotations properly.

    How can I add a v3d-annotation-dialog when the user clicks an annotation, to add a description. Also by this approach can we hide (fade) the annotations when it is obscured by some geometry. Please let me know.

    Thanks.

    #70093
    kdv
    Participant

    How can I add a v3d-annotation-dialog when the user clicks an annotation

    With the help of HTML puzzles (or JS code) and CSS rules. Read a little more about HTML and CSS.

    Also by this approach can we hide (fade) the annotations when it is obscured by some geometry

    It’s possible with using ray-casting.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #70096
    ps
    Participant

    Thanks for your suggestions. I will try it.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.