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.

Fadeout for objects

Home Forums Programming Fadeout for objects

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #23740
    mugga
    Participant

    Is it possible to fade out and object with puzzle/js function?

    The only way I would know of at the moment is, exporting a variable for the used material on the object which controls the opacity/transparency.

    #23748

    yes, this is the right way to go!

    Chief 3D Verger | LinkedIn | Twitter

    #23776
    mugga
    Participant

    Okay. Is there another maybe simpler possibility to do a fadeout?
    On a pure programmatically way, instead of “re-exporting” the 3d file with proper setup material?

    #23805

    sure, you can use the animate param puzzle (or the underlying JavaScript) for that
    https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#animate_param

    Chief 3D Verger | LinkedIn | Twitter

    #23820
    mugga
    Participant

    But how you do that? I havent seen anything like transparency. In order to change a value, I have to first set it in 3d.

    Maybe to be more clear of what I would like to achieve. I would like to fadeout a group or an object with just using javascript. Just as simple as in jquery for example would be great:
    $("#object").fadeOut();

    #24189
    web
    Customer

    I would also be interested in a simple way of fading out geometry/objects programmatically. Without setting up objects with proper material settings in 3d

    #24200

    well, you might try doing it three.js way, something like

    object.material.transparent = true;
    object.material.opacity = 0.5;

    Chief 3D Verger | LinkedIn | Twitter

    #24221
    web
    Customer

    For “object” I can just insert the name of the 3d object, correct?

    When I’m doing it this way I just get javascript error “cannot set property ‘transparent’ of undefined”

    #24260

    You should get object first
    var object = app.scene.getObjectByName( "objectName" );

    Chief 3D Verger | LinkedIn | Twitter

    #24396
    web
    Customer

    Doesnt work for me. Tried it on directly in the “prepareExternalInterface” with the code how you wrote:

    var object = app.scene.getObjectByName("Testgeo");
            object.material.transparent = true;
            object.material.opacity = 0.5;

    And also tried it the way I would like to have it:
    Custom functions in my “visuallogic.js”

    function fadeGeo(objectName){
        objectName.material.transparent = true;
        objectName.material.opacity = 0.5;
    }

    And execute it in my “normal app js” in “prepareExternalInterface”:
    v3d.puzzles.procedures.fadeGeo("Testgeo");

    #24411

    I forgot to mention that materials should also be created with code:

    object.material = new v3d.MeshPhongMaterial({ color: '#00BB00', emissive: '#550000' });

    Chief 3D Verger | LinkedIn | Twitter

    #24446
    GLiFTeK
    Customer

    hi Web.

    I’ve been wrestling with this one for quite a long time.
    I’ve come up with a number of workarounds.

    since there’s no “entire object opacity” .. (yet..grumble..)..
    ahem… B-)
    one path is to make the entire object ONE MATERIAL.. and use RGB paint values to differentiate subsets of the material that act as different materials.

    like here…
    actually sorry I’m afraid to post a link since the forum ritually erases my posts when i post links .
    https://www.soft8soft.com/docs/manual/en/introduction/Optimizing-WebGL-performance.html#Vertex_Colors
    …so look in the VERTEX COLORS section of the “Optimization Techniques” of the user manual. there’s a lot of power in that.
    when done like that.. you can use one value node to determine the opacity of the entire object if it’s all one material.
    i even went so far as to create an elaborate dynamic conditional if/then node network that takes RGB values.. converts them to RGBA values through a recommended formula then gives you freedom to use 25 or so decimal values of each channel (r/g/b/.. for different material nodes.. so it’s quite a range.

    I’ve been meaning to post that on github for people to use.. it’s been on the back burner while i get other things taken care of before needing it..

    I’m actually delving back into it now so I’ll put it up soon.

    ANOTHER WAY is.. one thing that myself and a few others have requested and are psyched that it’s here in v3d v3… is the OBJECT option in the Texture Coordinate node.

    using spherical (radial) texture to parse transparency, you can fade an entire object with multiple materials.

    i forgot how i did it.. and will have to dig it up ..doing that NOW actually…
    because i need it now…
    it’s using an empty that is linked to all the material’s transparency controlling values.. and when the empty is moved.. ALL the transparencies adjust at once..

    similar to what you see in Branden’s moving image in this link… (not hot linking cuz forum) …

    Object output for Texture Coordinate node

    I’ll keep you updated as i rummage through my old experiments (hope i named them easy to identify…) cuz this is a challenge I’ve been repeatedly coming back to as i have MANY objects that all need to fade all at once.
    :good:

    #24448
    GLiFTeK
    Customer

    yup/.. and i just wrote a huge post and it’s gone…

    i cannot believe this. it was a page long.

    #24495

    Sorry for the hidden post. It was the spam plugin false positive.

    Chief 3D Verger | LinkedIn | Twitter

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