Jump to content

Primitive UV maps


Pryme8
 Share

Recommended Posts

What is the standard UV map layout for a Primitive Cube?  If I just export a texture from a cube in my 3d program set to cubic will it transfer over?

And then to make this question even more interesting... how would I export a outline of a UV map created in BJS as say a JPG with the background being white and the polygon lines black.

Link to comment
Share on other sites

:)

Wingy starts by handing you a cold wash cloth, a chill pill, and an inflatable collaborator.  heh

- Standard UV map for prym8ive cube?  Learnable here:  http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors

- Will exported "box" with texture... transfer to BJS?  Likely.  Try it.  Read about your modeler's UV mapping.  View your exported .babylon file... see what you find in there. :)  Did you know that you can "paste" the data of a .babylon file... into a playground?  http://www.babylonjs-playground.com/#VMFNH#20  Now you don't even need a modeler... to test how BJS handles things that are "fed" to it.  Cool, huh? 

- Export a UV map created in BJS?  BJS is a viewer, not a modeler or texture editor.  :)

[Wingy flips-on the "listen intently" switch on Pryme8's new inflatable collaborator, and leaves to get fresh coffee]  heh

Link to comment
Share on other sites

see thats where im shifting the game...  BJS has the power and ability to be a fully deployed in browser 3d modeler it just no-one has really pushed that direction... But thats where I come in.  Ive deployed a similar system in unity's editor but stopped development on that when I started working on my WarMachine plugin for unity that was a procedural content generator.

Now is the time, I have a really really really big plan that I think you out of everyone kinda knows where Im heading from our private conversations. Its just a desperate scramble to obtain as much general knowledge of process I need to address before its time to tackle them.

From what Im reading though, it seems like we may not have an unwrap method yet,  I dont think it will be too hard to do a cubic interpolation unwrap for the time being just to get things rolling, but optimum angle and other projections may be a little rougher for me to figure out.

Link to comment
Share on other sites

ordinary i would say its a job for an 3d applycation... but if you have a special case of use lets try this:

 

i think the babylon cube has a full size planar mapping on every face. this means, if you add a texture, the texture gets mappet fully on every side of the cube. If you want to export the uv-layout just draw the uv coordinates on an 2d canvas. Note: the uv space normaly live in a 0.0 to 1.0 space.

Link to comment
Share on other sites

Spoder I love you, this is what information I needed.  Now, the question is can I overwrite this layered planar projection, physically not just in the GL interp.

Like I dont want the projection to be layered, I would want to be able to assign each uv face to a section of my 2d canvas, and when I bring it back in have it match.

Link to comment
Share on other sites

the uv-mapping is part of the model-information. this means, if you are going to create geometry ( including the standart primitives) at runtime, the geometry's information it stored in memory. If you want to save the model you need to create a file, which contains this informations, on the server side, for example.

Link to comment
Share on other sites

Would you be so kind as to demonstrate in a playground a simple cube made in bjs. Exported as an obj with a 6 side non tiled uv projection and if possible a black and white jpg of the 2d uv projection.  So that like let's say we reimport that cube and the jpg as the texture after we edited it's look in like photoshop and have it project the texture correctly.  I will do a back flip.

Link to comment
Share on other sites

You can just deploy it "there" (not "here"), but paste us a link to "there".  :)  This is a distributed commune and "here" does not accept deployments.  :D

The BJS main website accepts URLs to deployments, though.  If you play your cards right, you could have a link out there... that takes you to Pryme8's Cave.  Coooool.

(Why is it SO fun to mess with you, P8?  God, I love pummeling you.  You sure have a lot of energy!) 

Link to comment
Share on other sites

you can use ShaderBuilder Extension On BabylonJs 

http://www.babylonjs-playground.com/#FT2RY#30

and make your textures use with colors on the pix you need 6 colors on 2 first row you use others for other Color

mesh.material =    new BABYLON.ShaderBuilder()
			.InLine('if(nrm.x<0.){')  // face condition
			 .Map({ path: "textures/co.png", //picture url
			 indexCount: 3, // row and column Index count
              rowIndex: 1, columnIndex: 1, }) // select index of row and column
			 
			.InLine('} if(nrm.z<0.){')
			  .Map({ path: "textures/co.png",
			   indexCount: 3, rowIndex: 1, columnIndex: 2, })
			   
			.InLine('} if(nrm.x>0.){')
			  .Map({ path: "textures/co.png",
			   indexCount: 3, rowIndex: 1, columnIndex: 3, })
			   
			.InLine('} if(nrm.z>0.){')
			  .Map({ path: "textures/co.png",
			   indexCount: 3, rowIndex: 2, columnIndex: 1, })

			.InLine('} if(nrm.y>0.){')
			 .Map({ path: "textures/co.png",
			  indexCount: 3, rowIndex: 2, columnIndex: 2, })
			  
			.InLine('} if(nrm.y<0.){')
			  .Map({ path: "textures/co.png",
			   indexCount: 3, rowIndex: 2, columnIndex: 3, })
			   
           .InLine('} ')            .BuildMaterial(scene); 

co.png

Link to comment
Share on other sites

you see we have condition "if(nrm.x<0.)" you can manage that and find your face with normal and any other parameter

and about your pic you can make it 10x10 (row and column)

 

but for  big obj i recommand make uv map with other 3d applications

Link to comment
Share on other sites

it is possible but i think it is not useful UV map generator is big process for all mesh  

for make that you need canvas 2d render for draw your uv 

or you can make that on 3d and you need a optimized algoritm for open Mesh face on the flat 2d plan and screen shot on current look

 

 

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