hunts Posted February 18, 2017 Share Posted February 18, 2017 hello guys, i want to reduce the texture of a mesh using BJS, sceneOptimizer reduces the whole texture in the scene, how can i use it for a single mesh only? Quote Link to comment Share on other sites More sharing options...
davrous Posted February 18, 2017 Share Posted February 18, 2017 Hello, What do you mean by reducing a texture? David Quote Link to comment Share on other sites More sharing options...
hunts Posted February 18, 2017 Author Share Posted February 18, 2017 @davrous I tried scene.materials.pop() But it's not working Here's a PG: http://www.babylonjs-playground.com/#1V1HS3#0 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted February 18, 2017 Share Posted February 18, 2017 @hunts Splice and pop are JS "delete" functions, in that case, just do material.dispose();http://www.babylonjs-playground.com/#1V1HS3#1 But if you want to reduce the "size" of the material/texture; you can change the u & vScale http://www.babylonjs-playground.com/#1V1HS3#2 hunts 1 Quote Link to comment Share on other sites More sharing options...
dbawel Posted February 18, 2017 Share Posted February 18, 2017 @hunts - 2 hours ago, hunts said: Here's a PG: http://www.babylonjs-playground.com/#1V1HS3#0 As you're already setting the U and V scale for the diffuseTexture your in your material properties, what is it you are trying to achieve specifically, which you are not currently able to do? DB Quote Link to comment Share on other sites More sharing options...
hunts Posted February 19, 2017 Author Share Posted February 19, 2017 @dbawel I am trying to use something like scene.meshes.pop(), so I want to use the same thing on the materials, but it's not working Quote Link to comment Share on other sites More sharing options...
dbawel Posted February 19, 2017 Share Posted February 19, 2017 @hunts - It appears you're looking to use pop() as you might expect - to achieve the previous state of a mesh or property. However I don't believe that pop() alone will achieve this in BJS. It's been a while since I've attempted this, but pop() didn't behave as I might have expected - although I haven't attempted to utilize this since prior to babylon.js v2.0. Now that it is clear what you want to achieve, I expect other devs on this forum will explaing either why this is not working as might be traditionally expected, or how you can achieve this without having to dispose and restore or push manually. I wish I could be more help currently, but @Deltakosh, @davrous, or one of the big guns can most likely help us both better understand the usage and/or limitations of using pop() in BJS. I'll be looking forward to the answer as well. But mentioning these user names specificaly in this post should get their attention - so I might expect an answer soon. I could also list a few others who I'm certain know the answer, but I don't like to name names. But you guys know the list. Cheers, DB hunts 1 Quote Link to comment Share on other sites More sharing options...
hunts Posted February 19, 2017 Author Share Posted February 19, 2017 @dbawelthanks Quote Link to comment Share on other sites More sharing options...
JohnK Posted February 19, 2017 Share Posted February 19, 2017 Here is an analogy. The director has three actors in the scene, Jim Mesh, Tony Mesh and Ann Mesh. Jim is wearing a blue suit, Tony a brown suit and Ann a red dress. After watching the first run through the director decides he does not want Jim in the scene any more so crosses him off his list of actors for the scene. At the next run through Jim is not on the list for the scene so he is stopped from entering the scene. During the second run through the director decides that the red dress does not show up the blood properly after the stabbing, so he crosses the red dress off his list. At the next run through Ann is still on the list so she is allowed on stage but no one has told her not to wear the red dress. Crossing it off the directors list is not sufficient, Ann's costumer needed to have been told as well. Also remember actors.pop() means get rid of the last actor on the list, this might not be Jim costumes.pop() means the last costume on the list in not wanted, (this might not be the red dress though) but the actor wearing it also needs to be told about it so they can change. red_dress.dispose() means get rid of the red dress entirely, burn it so nobody else may wear it and any changes of mind will require the recreation of the dress from a length of red material. hunts 1 Quote Link to comment Share on other sites More sharing options...
hunts Posted February 19, 2017 Author Share Posted February 19, 2017 yeah the analogy is superb Quote Link to comment Share on other sites More sharing options...
hunts Posted February 19, 2017 Author Share Posted February 19, 2017 @JohnK Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.