Sign in to follow this  
Followers 0
JohnK

Is it possible to tile a texture across the caps of an extrusion (solved)

12 posts in this topic

@jerome Sorry to be pinging you twice in a couple of days but I am trying to solve this issue for a newbie, lhx880619 (see first post) and have NasimiAsl's brilliant magic solution but was wondering if a muggle solution was better for lhx880619. Do you have one?

Share this post


Link to post
Share on other sites

you can set your uv when you wanna crate extrude face (in face top and bottom )

you notic just vertex position (x and z ) and calculate uv with that uv.x = position.x and uv.y = position.z

* need change Extrude geometry maker function

 

Share this post


Link to post
Share on other sites

@NasimiAslI think both your solutions are amazing and if it was my problem I would use your shaderBuilder solution. However this newbie, lhx880619, is trying to transition from three.js where he can do what he needs in three simple code lines so I do not think he is ready for delving into vertexData.  However it looks like the only way would be a re-write of the extrusion cap code so perhaps there is not a simple way. I will show lhx880619 your solution and see what he says.

Share this post


Link to post
Share on other sites

mmmh... currently the cap the computed from the model shape barycenter what is fast (especially when the mesh is dynamically morphed) but doesn't fit the needs for people just wanting a fixed mesh and more versatility in the cap management.

This means I will have to implement something like a staticCap feature, a cap computed from a triangulation algo with some predictible positions, so uvs, if possible.

For now,  the capping algo can't do this unfortunately. The best choices are either to use the powerful shaderBuilder, either to design your own cap from a mesh appart, then to merge it to a un-capped extrusion

Wingnut and JohnK like this

Share this post


Link to post
Share on other sites

Wingnut has a dumb idea, as usual.  Use a decal.  Unfortunately, decals are not really dynamically updatable, and they are square/rect-only, at this point.

If a decal could be shaped by the shape data of an extrudeShape, we might have a chance.  But decals are a clipping festival inside their code, and I'm not sure if they can handle being ANY shape with ANY number of shape-points.  They would HAVE TO match shape and size perfectly, or else they might wrap onto sides of mesh, too.

John... this reminds us of Neshville, again, eh?  (No, NOT the country music town in Tennessee USA). Nesh 108. Overhead cam, black background, screen-grab RTT frame, send it thru Nesh's image thickener, use as cap.  :D

[Wingy slides a texture into the gel-frame of a spotlight, and tries to use this "slide projector" to project an image onto a cap, but then laughs at himself.   Then he accidentally stares into the spotlight and burns his retinas.]  :)

JohnK and hunts like this

Share this post


Link to post
Share on other sites

@jerome, @NasimiAsl and @Wingnut as usual I miss the obvious and get tied in knots. There is a simple solution that I have used before and completely forgotten about and that is PolygonMeshBuilder. Mind you it is easily forgotten as the documentation is very little, just the class. However I am working on this. Also working on a possible PR for MeshBuilder that includes MeshBuilder.CreatePolygon and MeshBuilder.ExtrudePolygon. Both will use PolygonMeshBuilder under the hood but will look more like the normal methods of building a mesh. Should a PR be OK then will of course do the documentation.

PG using PolygonMeshBuilder is http://www.babylonjs-playground.com/#PTTMVI

jerome and NasimiAsl like this

Share this post


Link to post
Share on other sites

Hi guys.  Yeah, that's a good idea... IF it can handle the birdData.

http://www.babylonjs-playground.com/#165IV6#36

The bird data FROM the polygonMeshBuilder demo... is the perfect demo data for capping tests... because of its "back-bays" (like an overhead view of a lake with lots of bays).  There's surely a more-tech-correct name for back-bays, though.  heh

I think... writing meshBuilder code that can "cap the bird"... is no small (bird) feat. If I were you, I would keep a medical team nearby... while you work on this.  :) 

MeshBuilder.CreatePolygon + MeshBuilder.ExtrudePolygon == ExtrudeShape, yes?  *shrug*

It almost seems like it needs some kind of AI "mesh crawler"... so that the wagon-wheel-style cap.... can be avoided. 

Folks might tend to say... in a knee-jerk reaction... "Wingnut, we're talking about UV mapping on the cap, not capping styles".  But those two subjects are intimately co-mingled (quite related), I think.

If you can cap the bird (with re-usable code), John... it's a steak dinner on me.  :)

Share this post


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

MeshBuilder.CreatePolygon + MeshBuilder.ExtrudePolygon == ExtrudeShape, yes?  *shrug*

No quite, MeshBuilder.ExtrudePolygon by itself will be a limited form of extrusion. ExtrudeShape allows you to do rotation and scaling along the extrusion path. ExtrudePolygon will only allow a linear extrusion normal to the polygon by a set depth, currently no texture on "bottom cap" (no drawing picture of a bottom cap please). ExtrudePolygon will not use ExtrudeShape but just another way of calling PolygonMeshBuilder with a depth parameter added. CreatePolygon will call PolygonMeshBuilder without a depth parameter.  The idea is if they look like the usual creation functions they might get more use but they are no more than a call to existing code.

In meantime have added PolygonMeshBuilder documentation

Hey Wingy am I getting close to the steak dinner https://www.babylonjs-playground.com/#1ZAXRO#3 :blink::)

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.