Sign in to follow this  
TomaszFurca

A way to create road on ground

Recommended Posts

Hi, I try to create road on ground. With stencil method in bledner after export big ground it texture is converted to 1024 px, so texture of ground is in very poor quality, so i make it in BJS using:

myTexture.uScale = 10.0;
myTexture.vScale = 10.0;

Then i have looped texture on ground with fine quality. But this method i can't create road on ground.

Some screens from bledner:

8Y30bK.png

Dx4l7D.png

mZIPjg.png

Is any way to create road using this way, but in BJS? I want to put road texture on white color (preview texture).

 

Edited by TomaszFurca
Please move this topic to questions :)

Share this post


Link to post
Share on other sites

hmm, no replies yet, eh TF?  Darn.

@NasimiAsl built SOMETHING with shaders, once.  https://www.babylonjs-playground.com/#1IAR36#12

It doesn't work these days, but Naz surely has an updated link.

I think... he was making walking paths across grass, or sand beaches around a lake... I can't remember.

All in all, this question is much too complex for MY intelligence levels.  Hopefully, others will comment soon.  Stay tuned.

Um... we might want to avoid the Blender stencil method and try another way.  That "convert to 1024" is unwanted, I think.

TF, do you want to make roads IN-SCENE?  Allow user to "draw" or "paint" roads?  Just curious.  :)  haha... Naz just asked same question while I was editing this post.  :D  Psychic!

Share this post


Link to post
Share on other sites

Sorry for not complex question.

I want to paint road on ground. Using stencil it is visible, but in very bad quality, so i decided to put texture on ground using BJS and then i have problem with paint a road on my ground.

I have one thought maybe i should make custom mesh and add to it texture of road? What do you think?

Share this post


Link to post
Share on other sites

Hi again, TF, thx for added info.

I have two playgrounds bookmarked... when I searched for "paint" in my bookmarks DB.

https://www.babylonjs-playground.com/#9U086#4

Works ok, let's you drag mouse around on dynamic texture.

http://playground.babylonjs.com/#YQ4GPC#1

I think this is an old shaderbuilder demo.  I think its reference images are 404. 

Let's ask @NasimiAsl if he has seen a newer version of that.

I think @Dad72 did some "paint-on-texture", and also @joshcamas.

Maybe others, too.  Let's keep listening to comments.  Maybe a forum search for "paint on" or something? 

The Blender stencil system might be fine, and might be output-size adjustable, but I have no experience with that.  Sorry.

Share this post


Link to post
Share on other sites
6 hours ago, TomaszFurca said:

Sorry for not complex question.

I want to paint road on ground. Using stencil it is visible, but in very bad quality, so i decided to put texture on ground using BJS and then i have problem with paint a road on my ground.

I have one thought maybe i should make custom mesh and add to it texture of road? What do you think?

Maybe this? 
http://doc.babylonjs.com/extensions/terrain
Using terrain material you can paint you ground as you wish

ps: It's not fair, I want to report a few users, like @aWeirdo, ... they are too fast for me :D

Share this post


Link to post
Share on other sites

Oh, guys... that's height-based texture blending?  Nice.

Won't work for roads, though... I don't think.  If roads were hilly... texture would be different at bottom/top of hills.  If TF's texture didn't have hills, then it IS a possible solve.  TF would make all his roads... at a slightly lower or higher height... than the rest of the terrain?

Then the road-drawing tool... would be a heightMap vert-elevation adjuster?  hmm.  We HAVE seen some paint-on elevation demos for heightMap "drawing"... but I don't know if TF would WANT roads to be slightly higher or lower than the other terrain.  (TF... for example... any vertex point on the heightmap that has an elevation (Y)... perhaps between -1 and -2... would be painted in gray asphalt color.)

*shrug*  Like I know anything I'm talking about.  :)  I could be well lost. 

Share this post


Link to post
Share on other sites

@Wingnut I hope I understand your idea.
So here is a demo:
http://playground.babylonjs.com/#9MPPSY
I did something similar a few time ago, but I modify terrainMaterial shader to accept 8 different textures. How it works: you upload your rgb mix map with your design, assign it to a dynamic map and after that paint the dynamic map with one of rgb colors. It looks great with more than 3 colors, but it works with 3 too. :D

Share this post


Link to post
Share on other sites
On 3/14/2018 at 10:29 AM, MarianG said:

@Wingnut I hope I understand your idea.
So here is a demo:
http://playground.babylonjs.com/#9MPPSY
I did something similar a few time ago, but I modify terrainMaterial shader to accept 8 different textures. How it works: you upload your rgb mix map with your design, assign it to a dynamic map and after that paint the dynamic map with one of rgb colors. It looks great with more than 3 colors, but it works with 3 too. :D

Yup, this is exactly what you need to do! Interestingly enough, this is how most engines do it, such as Unity and UE4. :)

This was what I wanted to do years ago with my editor, but back then we didn't have that nice terrainMaterial, so beautiful <3

Share this post


Link to post
Share on other sites

There is also CustomMateriel which can allow up to 8 diffuse textures rather than TerrainMaterial that supports only 3 textures.

That's what I use for my field editor.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.