# dreinzy

Members

10

## Reputation Activity

1. dreinzy reacted to RaananW in Shadow of invisible mesh
http://playground.babylonjs.com/#I2H3M#2
2.
Well done
3.
Hi.  I actually think that inverting a single triangle of a standard non-flat-shaded mesh... is impossible (but I could easily be wrong).  Often, triangles share vertices with each other, so if you invert the normal of ONE vertex, it affects many triangles (up to 6).
I haven't got a solution, but I built a playground scene to experiment-with.  http://playground.babylonjs.com/#CG2MJ#2
That one is WITHOUT flatShading.  When a mesh is set to flat shaded, vertices are added, with each new vertex having a normal (to the best of my knowledge).  In the above demo, look at the console.  100 vertices.  Take note of lines 31-33.  They are currently just like JcPalmer's code:
normals[normnum] *= -1; normals[normnum+1] *= -1; normals[normnum+2] *= -1; It is not working correctly, is it?  Now let's turn-on flat shaded.  http://playground.babylonjs.com/#CG2MJ#3
Refer to the console... now 486 vertices.  I also changed lines 31-33 to this:
normals[normnum] *= -1; normals[normnum+3] *= -1; normals[normnum+6] *= -1; There we go, a single triangle, backFaced.    It's not a hole, because we cannot see the blue background color there.
When we converted to flat shaded mesh, our vertices are less "shared"... so inverting a single vertex... no longer affects up-to 6 triangles (because of shared vertices).  Now you can invert a single triangle without affecting adjacent triangles.
How the normals are formatted after a .convertToFlatShadedMesh()... I have no idea.  But I did flip a single triangle, and hey, that's something, right?    Modify the code, do experiments, hit RUN again and again, and when you discover something, SAVE it and then send us the new URL so we can learn.  (thx).
Just for fun, let's apply a displacement map to the ground and wireframed ground2.  http://playground.babylonjs.com/#CG2MJ#4  Well look at that.  NOW the triangle IS a hole.  I can see blue through it.  Unfortunately, a black triangle resides below.  Maybe we should not be applying displacement maps onto flat shaded mesh, because it is apparently getting confused.
We also lost our flat shading after the applyDisplacementMap, I think.  This might happen because applyDisplacementMap is using normals to do its job... maybe.  Most people would use a createGroundFromHeightMap instead of applyDisplacementMap.  But it's all quite strange, eh?  And fun.
Even when using createGroundFromHeightMap... http://playground.babylonjs.com/#CG2MJ#5 ...convertToFlatShaded fails (activate line 30 - no subMeshes error).  How DOES a person get a flat shaded ground with BJS?  hmm.
Like this!  http://playground.babylonjs.com/#CG2MJ#6  Using the applyDisplacementMap method.  (I had a bug... quite 'normal' for me)  heh
Sorry that I couldn't explain WHY these things act this way.  I'm a newbie to these kinds of things.  Jerome has done some things with "double sided" mesh, so you might want to search the forum for that, too.  It's new, and I don't know if it is available for all mesh.  Good luck... keep us posted.
4.
Even on your second example I can see it and it is expected because you have two concurrent animations on the same property. So depending on the internal animator, they will override the same property.

You will need to force the action to cancel other ones before running: https://playground.babylonjs.com/#LXF99J#2 (Check the last parameter of the InterpolateAction constructor)
5. dreinzy got a reaction from NasimiAsl in Last frame of animation flickers after changing
Using the action manager's .registerActon and .then, if I start the next interpolation before the previous one finishes, it looks like the last 'frame' briefly flickers while the second one is playing.
https://playground.babylonjs.com/#LXF99J
Click the sphere to start it moving, click it a second time before it's finished animating to see the effect.
Is this the expected behaviour? Is there a way of avoiding it?
6.
This window is not in the export properties.  It is in the seldom used Scene tab of properties.  The reason is so that these settings can be saved in the .blend file.  This way, if you are exporting over and over during development, you do not need to fill out things every time.
As far as no baking, there is a switch in the source code you have to un-comment in mesh.py.  This is not really supported.  It is a left-over from development that I did not want to delete.
7.
Hiya DR, welcome to the forum.
Perhaps you have a JS problem, and not a BabylonJS problem.  Use console.log to 'watch' every action of your button-press event (the button onCLick event, the onClickHandler code, etc).  Ensure that the button handler code is called EVERY button click.  I think you may find issues... in those areas.
Here is a little playground demo... to test BabylonJS camera switching:
https://www.babylonjs-playground.com/#ZBTJP#6
It seems to work ok.  (This uses dynamically-generated HTML buttons.  BabylonJS GUI buttons available, too.)
Can you edit this playground demo (and save more versions of it)... and make it repeat the stated problem?
The playground app is our friend.  It makes it easy for everyone to help.
If you can reproduce the problem in a playground demo save, that would be great.  thx, and again, welcome.
PS:  The demo above has a minor issue with "stored camera inertia" after the switch.  I need to think about how to remove that.
8.
Thanks, Wingnut! you're a lifesaver. 😁
This is my first time using BabylonJS, I'll surely explore the AssetsManager.
Btw, just in case anyone else having the same problem, my actual imported mesh is consists of many mesh(es). It was exported from 3ds Max as a group. Thus, instead of