Tagged: batch geometry, flipped normal
- This topic has 13 replies, 4 voices, and was last updated 9 months, 2 weeks ago by
Michael Grebstad.
-
AuthorPosts
-
2024-02-01 at 10:43 am #70083
Michael Grebstad
CustomerHi im trying to optimize my scene, it currently consists of many instances which is flipped because of symmetry, for instance i have a steel frame that is symmetrical, what i did is, i duplicated it as instance and flippet it, having x1 y-1 z1, when this is applied the faces becomes flipped as expected, this can be worked around using double sided, and double sided shadows, and setting alpha clip in blend mode to allow ambient occlusion.
BUT, when i use Batch geometry this does not do what i expect, the flipped half of the object becomes dark, something about shading, this is strange because if i try to merge these two instances before export leaving the other half with flipped normals, everything looks normal.Attachments:
You must be logged in to view attached files.2024-02-02 at 8:43 pm #70107xeon
CustomerThis is an interesting issue.
There is an issue when you scale an object on any single axis as -1 when you plan to use the Batch Geo puzzle. Lets just say that doesnt work well.
If you want a mirror of your original object…then try 1, -1, -1. That will also fix the dark issue and it will work using the Batch Geo puzzle.
However the better solution would be to scale your object to 1, -1, 1, then Apply Scale.
If you notice the faces get inverted. Flip the normals and then you can include it in your batch for the Batch Geo puzzle and all will be good.Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-02-06 at 7:39 am #70146Michael Grebstad
CustomerThanks for the repsonse Xeon, however in my case i cant use 1, -1, -1. because of the symmetry, at least that i know of, i havent explored in depth.
Also if i apply scale i would end up with two objects, not one instance. i did this on purpose to lower the file size tremendeously.
Maybe there is a way to apply scale and recalculate normals afterwards in code,, but it might be very heavy task for any device.
2024-02-06 at 9:51 am #70147Ben
CustomerHi Michael,
I’m working on a scene that sounds very similar to yours and came across the same issue – I’ve got an array of tiles and every other tile is flipped on an axis to create a kind of repeating symmetrical pattern. I found that the flipped tiles were shaded fine when separate, but when I batched them all every other tile was darker.In my case I found that when batched the flipped tiles took lighting info from the underside instead, so since my HDRI was darker underneath the tiles were receiving less light and appeared darker. I was able to solve it by switching the material to a simple emission, since shadows etc weren’t important in my case. I expect a uniform background light would also do the job.
I’m not sure how you could get them shaded correctly by directional lights etc though, is there any way to flip normals in verge?
2024-02-07 at 11:21 am #70196Michael Grebstad
CustomerHi Ben, thanks for the reply, if i could leave them unshaded then problem solved, but i have to use shading, for a bit of realism.
At the moment im trying to explore the code behind the batch procedure, but im not a programmer.
2024-02-07 at 11:45 am #70199kdv
ParticipantShare your test app (with the .blend file) here. I’ll try to find the solution.
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-02-08 at 12:26 pm #70277Michael Grebstad
Customer2024-02-08 at 12:31 pm #70280kdv
ParticipantOk, good test ))) But now zip it and attach the archive here )))
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-02-09 at 5:38 pm #70358kdv
ParticipantSolution:
https://www.soft8soft.com/docs/api/en/core/BufferGeometry.html#computeVertexNormalsi duplicated it as instance and flippet it, having x1 y-1 z1
Actually, the scale of the mirrored clone is (-1, -1, -1)
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-02-12 at 10:38 am #70424Ben
CustomerHi kdv, would you mind giving a quick example of how to use .computeVertexNormals() ?
I have very little knowledge of coding, would it use an exec script node?
Have gotten as far as trying the below amateur attempt in an exec script without any luck:var obj = app.scene.getObjectByName(VARS[‘object_reference’]);
obj.computeVertexNormals()Thanks!
2024-02-12 at 10:40 am #70425kdv
Participantif (obj && obj.geometry) obj.geometry.computeVertexNormals();
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-04-30 at 9:10 am #72562Michael Grebstad
CustomerHi Kdv, its been long since ive looked at this further, thanks for the sollution, however im not very skilled at coding, yet, can you please provide a more practical explanation to how you got the test to work properly?
2024-04-30 at 10:25 am #72563kdv
Participantin an exec script
const obj = app.scene.getObjectByName(VARS['object_reference']); if (obj && obj.geometry) obj.geometry.computeVertexNormals();
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-05-08 at 8:14 am #73278Michael Grebstad
Customerthanks kdv!
-
AuthorPosts
- You must be logged in to reply to this topic.