JonVarner Posted August 3, 2018 Share Posted August 3, 2018 I think I am missing something in regards to texture smoothing. My situation is pretty basic as I am just trying to swap out the diffuse texture on a material with another one. However, when I do, the texture goes from looking smooth the very poorly anti-aliased. (In the example below I used the same .jpg so that it was easier to see the difference) Example: for(i=0; i<window.sidingShaders.length; i++){ uScale = window.sidingShaders[i].diffuseTexture.uScale vScale = window.sidingShaders[i].diffuseTexture.vScale var otherTexture = new BABYLON.Texture("babylon/textures/" + imageName + ".jpg",window.scenario, true, true, null, function() { for(i=0; i<window.sidingShaders.length; i++){ otherTexture.samplingMode = 2 window.sidingShaders[i].diffuseTexture = otherTexture; window.sidingShaders[i].diffuseTexture.uScale = uScale window.sidingShaders[i].diffuseTexture.vScale = vScale } }); } Quote Link to comment Share on other sites More sharing options...
JonVarner Posted August 3, 2018 Author Share Posted August 3, 2018 Ok, so its turned out to be one of those things that I look for hours for a solution and then right after I post I figure it out. But for anyone else who may run into a similar issue, adding BABYLON.Texture.TRILINEAR_SAMPLINGMODE solved the issue. var otherTexture = new BABYLON.Texture("babylon/textures/" + imageName + ".jpg", window.scenario, false, true, BABYLON.Texture.TRILINEAR_SAMPLINGMODE, Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted August 3, 2018 Share Posted August 3, 2018 It's just the options you have put in your texture constructor which are wrongs. https://www.babylonjs-playground.com/#K4S3GU#23 (line 27 to choose texture01 or 02) http://doc.babylonjs.com/api/classes/babylon.texture#constructor [edit] by the way I think I will try to patch the doc to be able to see which number equel which value in samplingMode Quote Link to comment Share on other sites More sharing options...
JonVarner Posted August 3, 2018 Author Share Posted August 3, 2018 Thanks V!nc3r. 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.