About Store Forum Documentation Contact



Post Reply 
Terrain Painting
Author Message
aceio76 Offline
Source Licensee

Post: #1
Terrain Painting
Hi guys,

I've been struggling with this for a bit, and I thought it might be worthwhile if I share this with the you guys, hoping someone might have ideas on how to resolve it.

I am writing code where it will generate terrain and paint texture over it based on profile-based settings. The specifics of that is not that relevant to the issue, but how the terrain is painted is. You see I have code that sets a base texture then paints another texture based on terrain height, then another texture for "feature marks" on the terrain. For testing, I have the code paint a texture under static objects (think of trees, rocks, etc). The base and terrain-height texture painting works, but when I have the code paint texture on smaller areas under objects, I get blockiness on what seems to be very random scenarios. I've included a screenshot to depict my issue.

The terrain is low res:
Code:
heightmap.build(mesh, 2, 6, false, null, null, null, null, null, null, null, null)

The resolution is only 32x32 (33x33 in actual usage). I found that at this resolution, painting is only possible on 0, 4, 8, ... coordinates, but when the terrain is changed due to its height, these coordinates doesn't seem to apply where the textures may not paint properly, as seen in the image below.

The texture painting is done something like this:
Code:
heightmap.setMaterial(tileX, tileY, mtrl, null, null, Vec(1, 0, 0))

How should I approach painting so that the blockiness is eliminated?


Attached File(s) Image(s)
   
(This post was last modified: 11-15-2015 05:51 AM by aceio76.)
11-15-2015 05:48 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Terrain Painting
Hi,

Perhaps you're exceeding the limit of 3 materials per a triangle.

'setMaterial' sets materials per vertex, so you can have 3 materials in a vertex.

However the triangle has 3 vertexes, so 9 materials in total are processed from the vertexes per triangle.
Due to "3 materials per triangle" limitation, only the 3 most significant out of the 9 will be selected.
11-15-2015 06:48 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Source Licensee

Post: #3
RE: Terrain Painting
Thanks Greg, that was the last clue I needed. I thought I only assigned no more than 3 per triangle but after some additional testing to validate that, I end up with a 4th texture on transition areas from terrain theme to another.

Thanks again for the advice, it was very helpful.
11-18-2015 06:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Terrain Painting
Next release will have the limit raised from 3 to 4.
I hope it will be helpful.
04-15-2018 05:29 AM
Find all posts by this user Quote this message in a reply
Post Reply