Jump to content

Issue with texture smoothing


JonVarner
 Share

Recommended Posts

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
                                
        }
    });
}

 

example.jpg

Link to comment
Share on other sites

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,

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...