Jump to content

pixelate texture for CreateGroundFromHeightMap?


zahachtah
 Share

Recommended Posts

I know its a nice feature that the texture in the height map does smear out the pixels of the underlying texture image. But I just happen to need to see the pixel borders very clearly on the ground. is there a way to set the material to do this?

I am using the demo for CreateGroundFromHeightMap as base

http://playground.babylonjs.com/?14

Sorry if this is trivial, trying to learn....

 

Jon

Link to comment
Share on other sites

one other trick I use, is to change the uScale and vScale values of the texture.

	var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", "textures/heightMap.png", 100, 100, 100, 0, 10, scene, false);
	var groundMaterial = new BABYLON.StandardMaterial("ground", scene);
	groundMaterial.diffuseTexture = new BABYLON.Texture("textures/ground.jpg", scene);
	groundMaterial.diffuseTexture.uScale = 6;
	groundMaterial.diffuseTexture.vScale = 6;

Try http://www.babylonjs-playground.com/#10JKYM#3, change the uScale and vScale values to 1. You'll notice immediate pixellation as the texture is being stretched thin.

Before pixellation

Screen Shot 2016-05-03 at 10.06.42 PM.jpg

After pixellation

Screen Shot 2016-05-03 at 10.06.31 PM.jpg

Link to comment
Share on other sites

Thank you all for your answers. I am not getting anywhere near what I need though. I need the ground to show the exact colour of that texture pixel (texture has same size as height map). I added the following which I found from another thread:

ground.coordinatesMode = BABYLON.Texture.PLANAR_MODE;

 

but that did not help either: http://www.babylonjs-playground.com/#10JKYM#6

 

It seems like the texture-image has been resampled? Is it possible to turn this off?

 

I need the ground to look something like this at close range (i.e. sharp edges of the pixels):

 

pixelated.png

 

 

I would greatly appreciate any further insights from you kind people :-)

 

Many thanks

jon

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...