Forum Replies Created
-
AuthorPosts
-
webCustomer
Nice works now for me too.
Thanks mateOne step closer to a more efficient preload.
webCustomerOkay, so no way for a quick change via javascript.
webCustomerThx for the addition
webCustomerI wanted to bring this thread up again.
I would really like to implement a replace all textures function to my apps. This is what I currently got:
app.scene.traverse(function(obj){ if(obj.material && obj.material.type == 'MeshNodeMaterial'){ var mat = obj.material; for (var i_index in mat.nodeTextures){ var imageSrc = mat.nodeTextures[i_index].image.src; var imageFilename = imageSrc.split('\\').pop().split('/').pop(); var loader = new v3d.TextureLoader(); loader.setCrossOrigin('Anonymous'); loader.load('./assets/512/' + imageFilename, function(texture) { mat.nodeTextures[i_index].image = texture; mat.nodeTextures[i_index].format = v3d.RGBFormat; mat.nodeTextures[i_index].needsUpdate = true; }) } } });
The images seems to get loaded correctly regarding the source/url but I see no update in the webGL. For some maps I get an error in the browser console:
v3d.WebGLState: TypeError: Failed to execute 'texImage2D' on 'WebGL2RenderingContext': Overload resolution failed.
Could anyone give a hint what could be the issue?
I tried to compare my functions to the replaceTexture puzzle but couldnt see any issues. Except that my function is purely for jpg based textures.webCustomerOkay, thx for the explanation.
So if you want fastest loading glTF is the way to go. Only drawbacks could be lower graphic quality.webCustomerSorry to hijack this thread. But could explain the glTF compatible thing a little bit more?
I’ve looked at the documentation but it wasnt clear for me how this leads to faster loading. For example, would loading time decrease when you change a material with single diffuse texture to glTF compatible?
Or is this only applicable for more complex shader?
webCustomerJust did some testing. You can easily the depthTest attribute for a material via javascript.
I was just wondering if you could alter material settings on runtime instead of “recreating” a material, which I’m doing at the moment.
At the moment I running a function on hover for specified objects at creating a material like this:
function initial(objectname, depth){ var object = getObjectByName(objectname); var colorHighlight = new v3d.Color('#004380'); object.material = new v3d.MeshLambertMaterial({ color: '#000', emissive: colorHighlight, emissiveIntensity: 1, opacity: 0.5, transparent: true, depthTest: depth }); }
webCustomerI had some code for detection like mentioned in one of the post. It was working so far, but later in the project I got heavy slowdowns/performance drops and I could track the issue down to that function. So I had to delete it…
webCustomerMaybe, but its also a click. I had this issue with one project. A big part of the geometry was clickable which executes a particular animation. But when you just clicked and dragged to navigate the camera, the function was executed as soon as I released the mouse. There needs to be somekind of detection if the mouse have been moved in the past 200ms or so and If not its a click. When it has moved its just a drag/rotate.
I just see now that you responed to the thread I wanted to refer to:
webCustomerHey GlifTek,
unfortunately not. Didn’t had the time and found another way for the current project.But I will set me a reminder to have a look.
webCustomerGreat additions
Does the new/updated onclick function also takes a “real click” into account?
I mean that navigating the camera with the mouse doesnt accidentally trigger an object click event.webCustomerGreat thanks
webCustomerHey Yuri,
thx for your response. I know that this would even now be possible with the mentioned replace texture puzzle.
This was just an idea for future versions, to optimize verge3d even more in regards of file size. And instead of having a own implementation of that function an official one from your side would be great.
I think that you guys also would be quite quicker in implementing such a function than me
webCustomerGreat, thank you. Will have a look at that.
webCustomerSorry, dont get it. I dont need scrolling and I already know how to setAnimatedFrames. I think its to advanced stuff, which would need some serious reworks. Will try to get this solved on my own.
-
AuthorPosts