Jump to content

Can babylon do this?


typohneworte
 Share

Recommended Posts

@dbawel Thanks, I think.  :)  You aren't going to try to kiss me, are ya?

http://playground.babylonjs.com/#21K2OV#2

Ok, had to reduce line 30 to size 128... not sure why.  It's likely a "power of 2" thing that @dbawel will explain shortly.  ;)

We also needed that line 45 updater.  I got hung-up on that wench... on another project... Wingy's mostly stolen dynamic text wordwrapper...

http://playground.babylonjs.com/#A1CMR

@typoh, isn't it strange that I can assemble a massive word-wrapping dynamic-text paragraph-printing playground demo, yet I can't get a single word to print on your boxes?  Pathetic, right?  I hear ya.  I got some stripes, though, and hey... the box didn't disappear!  YAY!

I thought for a moment... that your cube models might have their UVs all messed-up, but... a standard texture test... looked fine. 

Still thinking.  Not sure what the issue is, yet... sorry.  Busy days for me, lately... reassembling an old band into a new one.  But mostly busy cuz... I bought GTA 5 (erf)  (Hey, I got it on sale so stop rolling your eyes, people!) 

Man, what a VR environment THAT thing is.  phew.  Gorgeous. (off-topic drool).  But I think Babylon Bay VR World (by the makers of BabylonJS) will be every bit as cool. :)  Ok, Wingy, back to work.

Fun:  My CPU fan spins-up to about double speed when GTA 5 window goes active.  Doing a similar world in webGL... I bet I would need the ammonia cooling system from the space shuttle.  :)

 

Link to comment
Share on other sites

The only word I would use for my explanation as to what might be occurring is "baffled.":huh: This scene defies all explaination for me, as I can find no reason or canvas reference which might cause setting the resolution of the dynamic texture to 128 to result in the texture drawn on the cube. 

I'm really beat up tonight as I've been living in my own personal development "hell" today, and this scene has practically caused a brain hemorage - as I cannot find any explaination for what is happening. So I appriciate the confidence Wingy, but I'm at a loss for this one. If you got this to work simply by trial and error, then I understand - however, if you had a reason for using a value of 128, then I'd really like to hear why you selected this resolution; as I can see no reason why this and no other value (power of 2 or not) might work.

Time for bed - that is if I can avoid the babylon void which plays out in my head nightly when I'm accosted with a scene such as this. I hope a solution is found - at least one that makes real sense.

DB

Link to comment
Share on other sites

@typohneworte... the "kiss" comment was for @dbawel.  (Just in case you got confused, with that.)  I was having fun with his likely-unwarranted high-praise of me.  :)  DB works on some very cool stuff... I wish I could hang-out with him.  I'm discovering that he is an eloquent wordsmith, too.  Thanks for the kind words, DB.

Ok, back to this beast.  When I take the babylon file ... https://cdn.rawgit.com/typohneworte/myFirstApp/master/mycubes.babylon out to the json beautifer http://codebeautify.org/jsonviewer

materials
[7]
multiMaterials
[1]

... we can see that multi-materials are involved.  The mistake we might be making... is in applying the dynamicTexure to a multi-material.  Most likely, we should be applying the dynamic texture to ONE material... the one that is on the camera-facing face of the cube/box.

Upon further experiments, we see this... http://playground.babylonjs.com/#21K2OV#3 

I disabled mat0 and mat1, assuming now, that the boxes already have materials.  We just need to look them up in scene.materials array.  I printed them to console in line 29 and I set the dynaTexture on 2 of those multimaterials... in lines 35/36.  It doesn't look good.  The multi-materials are UVW-mapped onto the boxes very strangely, it seems. 

SO, as of this time,  I am predicting that there is an issue with the 3DsMax scene itself, or with the exporting of it FROM max.  It might be time to try some modifications of the Max scene.  Just possibly, we want NO multi-materials on the Max-based cubes, but STILL have a UVWunwrap modifier on the cube(s).  I'm not sure what this would accomplish, and I don't know if we have any export-from-3dsMax experts nearby.  I don't think we have any decent tutorials on the subject, either.  It would be a mix of 3dMax tutorial, Max exporter tutorial, and Babylon tutorial  (all about HOW these three subjects interact with each other at export time).

All in all, we're making progress, as typoh says.  :)  Ok, I'm off to get more coffee and think this over some more.  Typoh, you might want to try some more Max scenes and exports thereof.  It seems something is wrong with the mapping of the multi-material (UVW/unwrap).  Maybe some forum experts on these subjects... will help us find the issue.  But, we're closing in on it, I think.  Talk again soon. 

Link to comment
Share on other sites

I have removed the multi material which was placed onto the objects in Max and re-exported without any material applied.

http://playground.babylonjs.com/#21K2OV#5

If it's possible to target each polygon of the cube's face (set by the polygon ID inside MAX) and individually change their colors I'll be wrapped! It looks possible with the code you've posted above:

scene.materials[1].diffuseTexture

I have assigned a random ID number of 9 to each of the top six polygons on the single face, keeping the original ID 1, ID 2, ID 3 the same (scene.materials[1].diffuseTexture, scene.materials[2].diffuseTexture , scene.materials[3].diffuseTexture).

I'll work on adding some text to this and hopefully the evil lines stay the hell away!

Cheers!

Link to comment
Share on other sites

Good deal... progress happening!  Well done.  Also keep in mind that you COULD just position a plane up against the side of the box... that has text on IT.  Essentially, dynamicTexture->plane labeling system for ANY mesh.  *shrug*  But yeah, as far was what the heck 3DMax is exporting... not sure.  Examining the .babylon file via a JSON beautifier or with notepad... tells all.

Yeah, the BJS framework offers user access to ALL the model characteristics... via the vertexData object.  You can think of it as "the geometry", I suppose.  Most mesh have a vertexData obj associated with them (look for mesh.getVert* funcs) and each vertexData is packed with positions, colors, indices, uvs, etc... in arrays on that object.  Make sure you set your mesh to UPDATABLE when its created.  After that, you can whack away at the shape arrays... til ya vomit from too much fun.  :)

The .babylon file "SceneLoader" likely generates these vertexData objects... per the information in the inbound .babylon JSON.  Mesh spawn!  The base class Mesh and its papa-class AbstractMesh have gazillatons of properties and methods on them... enough to take over the world!

Get organized.  Make a "all about BJS" links page... put a link to the docs searcher, forum searcher, playground searcher... all on that one easy-access little local webpage.  Now you're ready for combat.  :) 

As far as 3D max operations... phew... ya might have to wander into 3D Max forums.  It's a big fat modeling program, eh?  'Bout a year to get comfortable with it, depending upon previous experiences with similar things.  Same thing for max... make a little webpage on your computer... "everything Max" and have 10 links to the hottest info-sites... for 3dsMax.  Bend those learning curves wherever possible, ya know?  ;)  Keep us posted.  I'll keep thinkin', too.

Thanks for the test playgrounds... made me go "hmm".

http://playground.babylonjs.com/#21K2OV#8

This uses the more-conventional 'drawText' function that is provided as a convenience... by the dynamicTexture class.  Nothing interesting discovered.

Link to comment
Share on other sites

@typohneworte -

I don't have 3DSMax installed on my laptop, so if you have time to write an FBX file out of 3DSMax (which will most likely be a binary file), and then use the free FBX converter to convert the binary FBX file to ASCII, we can then easily open this up for review. Perhaps this might allow us to see what is occurring, and will certainly allow us to be able to edit the file and to test a few theories which might help us solve each suspect problem we are currently observing. Other than this, I cannot think of a better way we might proceed in troubleshooting the scene, 

However, please keep the test scene as simple as possible; although the scene appears very simple already. If you are able to convert to an ASCII FBX file, we should be able to observe much more of what might be occurring in the scene.

Cheers,

DB

Link to comment
Share on other sites

I've uploaded the FBX file HERE

Wasn't too sure about the ASCII FBX file but I found an export for an ASE format which might be what we need. You can find it HERE

Let me know if this isn't what you're after.

I think attaching a plane to the surface and adding text to this might be the direction. I haven't found any resources regarding curved text (following an arc or circle path).

3D Max is a bit of beast! Been using it for a little while now. Mostly for 3D Viz work.

Cheers

Link to comment
Share on other sites

@typohneworte... when you made the cubes in Max... did you use subdivisions?  In other words, when viewed in wireframe mode in Max, is the height/width/depth of the cube... 3-subboxes by 3 sub-boxes by 3 sub-boxes?  These playground tests we're seeing... make it look like the cube DOES has subdivisions (looks like 27 little cubes make up the big cube). 

If they do have subdivisions, you'll want to remove those.  They WILL affect your UVW unwrap if you are using that modifier.  I would make your cubes have ONE height, width, and depth segment.  Then try some more exports... maybe one with UVWunwrap modifier, maybe another without, but avoid subdividing the cubes, at least for now.

Keep us posted.  thx.

Link to comment
Share on other sites

Hi.  Did you plug those URLs into our playground and see what happens?  I'm getting 404 errors on your two recent links.  Those two URLs are formatted different from your first one.  Can you check on all that, please?  thx. 

I don't need any other save formats, because I can read the .babylon file once I send it to an online JSON treeviewer such as http://codebeautify.org/jsonviewer .  But, just because I can read the .babylon file, doesn't mean I know what I'm doing or what I'm looking for.  :) 

Did you do some home testing on those two new Max-exported files?  See anything interesting? 

After we try those two new exports in your home tests and in playground tests, and if they still have problems... DB will likely want to see alternate formats of those two files... to help him see what's shakin'.  Talk again soon.

 

Link to comment
Share on other sites

Does this link work? Click Me

Within the playground, leave the address the same...

https://cdn.rawgit.com/typohneworte/myFirstApp/master/

and replace mycubes02.babylon with mycubes03.babylon or mycubes04.babylon.

If this didn't work, it could a result of this github message I am receiving. I've contacted them to take me off the robots list. Sheesh!

github-msg.jpg

Link to comment
Share on other sites

Ok, should I leave-out the '/blob' from the playground urls, yes?  cdn domain, or what?  I'm confused... but so what. 

http://playground.babylonjs.com/#21K2OV#9

Got it turned on.  :)

Same symptom as before, but bigger!  Yay!  Let's call that progress.  Now, if we can just get it mapped correctly.  We can see the colors, so we know the text is being printed.  But, it's being mapped onto the box... kitty-wompussly or something.  We're viewing the text from... across the tracks... from the "bad side of town".  hmm.

What an interesting github message!  You've been busted... accused of being bionic!  hehe  Too funny!  Perhaps mail them a urine sample, hunh?  :D

Just to show that text on boxes DOES indeed work... http://playground.babylonjs.com/#1DPATQ#1
 

Line 124 vertex-coloring on the larger plotted shape... USE TO work, I think.  It is not doing so well, now, when activated.  Probably a Wingy mistake, as usual.  ;)  Maybe someone was fooling around in there and inverted my normals.  It's not unusual - my whole life is inverted-normal.  Different subject, though.

Update:  vertexColors need to be color4, not color3, these days.  Lines 79-86 needed a "1," added to each (the alpha value), and then line 124 turned on nicely. http://playground.babylonjs.com/#1DPATQ#2   :)   Different subject, though.

Link to comment
Share on other sites

Download the free FBX converter from Autodesk and install it. Then export an FBX file out of 3DSMax, and use the FBX converter to convert the FBX file to the ASCII format. This is self explanatory, but if you need help accomplishing this, let me know. Once you have converted to an ASCII FBX file, post this and then I can open it to see if there are any obvious issues with the file, formatting, or some bug which has suddenly appeared in the process.

If you can do this, we can role out allot of potential issues, and you'll also now how to do this as well as edit these yourself which often saves me considerable time in production.

Cheers,

DB

Link to comment
Share on other sites

@dbawel - I've got the ASCII format for you here (is this correct?)

mycubes10.ase

@Wingnut - What works for me is changing only the mycubes01.babylon to mycubes05.babylon or mycubes10.babylon (latest) etc and leave the other part of the url as is from the first lot of playgrounds. Seems to display the cubes okay...

with mycubes10.babylon I have set one cube to have only the one material ID (instead of one face having its own ID). This allows these o so annoying stripes to show on all 6 sides instead of just the 1. This might strip back the problem a little more.

 

I'm back to human status on github. This was why some of those links werent working. All good now, they've analyzed the urine sample and found no traces of machine oil.

 

Link to comment
Share on other sites

@typohneworte -

I was looking for an ASCII FBX file, however I will try and evalute the Adobe ASCII fle you sent to see if there are any isues which might be causing your problems. I'm not at all familiar with the Adobe fASE format, but will perhaps see any discrepancies based upon my experience with the FBX format.

So far I don't see anything out of the ordinary, but the infor in an ASE file is very different from its FBX counterpart. If I have time this evening, I might download the binary FBX file you have posted, and convert to an ASCII FBX myself. As only then might I see what could possibly be causing the issues with texturing your mesh files. I'm really busy trying to finish and deliver an app, but may find time tomorrow if not late this evening. And this is only an additional step in troubleshooting, as at least I have the scene to load into MotionBuilder to test - where I can most likely find the problem if I can find the time.

DB

Link to comment
Share on other sites

Any new news here, Typoh?  Have you seen the 3dsMax checkboxes when you create the box?  Creation method box or cube?  (I would choose box to start-with.)

Generate Mapping Coords checked?  I don't think we need a UVW-unwrap modifier if that is checked.  I'm speculating, though. 

For testing, I would try NO material.  Then examine the .babylon file after export.  Let's see how small we can get that .babylon file, and let's see if we can do ALL our material work... within BJS, for now.

When we add a material in Max, we have other issues that COULD get in our way... like that "face map" checkbox.  With a basic BOX, and no material, but Generate Mapping Coords set true... we SHOULD get some UVs in the .babylon file... the most basic type.  Then we'll do some more playground tests.

I would REALLY like to get a help file written about this issue, eventually.  It makes me sad to see you have to struggle with this, for this long... or at all.  I would come on-board better if I had a newer version of Max, but...  $$$$.  No room for that in my life... so no exporting from Max for Mister Wingnut.  My version is too old.  There used to be a free, limited version of Max called Gmax, but I don't know if it's still being produced, and I don't know if our Max exporter would work on it.  hmm.

I know Blender can be a larger pain-in-the-butt to pilot than 3dMax, but, have you ever thought about using Blender instead of Max?  I like Blender's FREE-ness.  We could both be doing test exports if we both drove THAT modeler.  Not that I am any good at piloting Blender, but, maybe we could learn it together, along with help from resident Blender God Gryff.

All in all, I want to see this issue through to resolution, and learn from it, so we can pass-on the learning to future users.  Test test test.  (thx)

Link to comment
Share on other sites

  • 4 weeks later...

I'm back!

Been looking into this more and found a really good page about MeshBuilder.

https://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors

Playground:
http://www.babylonjs-playground.com/#1V3CAT#15

The question after reading this is, can a single face from the cube be divided up (6x6) and an array of colors be applied to them?

My end goal is to have something like this for my product (perhaps a little ambitious): https://xboxdesignlab.xbox.com/en-US/customize/thumbsticks

 

Hope all is well!

Link to comment
Share on other sites

Hi typo... welcome back!  Ever thought about using 6 planes... parented to a box, and placed in such a way as to make them LOOK like they are all part of one face of the box?

Here's a multi-color tiled ground demo.  http://www.babylonjs-playground.com/#1VGWP9#8

Place that... against one side of a box, and you have 64 colors on one face.

How about 256?  http://www.babylonjs-playground.com/#1VGWP9#9

But 6 planes, each with their own material and diffuseColor.... would be easy and sleazy.  :)  ActionManager per plane, and you've got discrete click-regions, too.

Tiled ground clicking regions would be more difficult, I think.  Tiled ground use subMeshes, and I'm not sure if I have seen ActionManagers used per-subMesh.  I don't think so.  To determine which tile of a tiled ground was clicked-upon, you would likely need to accurately analyze the X/Y point of the click.  The separate-planes method would give you more control, I suspect.

Link to comment
Share on other sites

@Wingnut - might be onto something - but if I understand correctly, this should be very easy to do using several different methods which will most all work well. THe FBX file you provided was simple to read - but again, this appears to be a very simple scne. I'm still not certain how you want the final scene to function, so please provide whatever info you hve, and et's try and come up with whatever ansers you might need.

DB

Link to comment
Share on other sites

  • 2 years later...

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