Dinkelborg Posted November 9, 2014 Share Posted November 9, 2014 Hi,I am momentarily writing a report about BabylonJS and as I was analysing my scene I came up with the questionif any new instance of a ShadowGenerator would also create a new Texture for its shadow map ...I guess (soly based on the constructor parameters) that each ShadowGenerator creates a Texture of the size specified in the constructor parameter and that the renderer (or a post processing entity) will combine all those shadow maps at the end.Is that true or does it work in another fashion?Thanks for the answers in advance,Dinkelborg Quote Link to comment Share on other sites More sharing options...
Dinkelborg Posted November 9, 2014 Author Share Posted November 9, 2014 Oh and if somebody who can answer this question would be here already, I just came up with another question about the inner functionality of the prefab-objects:If I change the "scaling" attribute of a cube, will this cause the cube to be scaled every frame as it would be in other frameworks or is there some internal optimisation for this?Since in the constructor for a box for example there is only one size attribute, I assume that it internally generates a geometry object which is equilateral.The only way I see to control the boxes outer appearance then is to change its scaling, in other frameworks this is something you normally want to avoid for performance reasons, and therefore you will rather create a new geometry for your mesh and change the appearance for that (because then the box will not be scaled every frame...) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 10, 2014 Share Posted November 10, 2014 Hey, this is perfectly true: each shadowgenerator generates a shadow map per light that standardmaterial uses to render meshes Changing scaling, position or rotation change the worldMatrix of the mesh. This matrix is computed only when required. THere is a huge optimisation around matrices in order to reduce required computations per mesh. So once the scaling is change, it will trigger a worldMatrix update. during rendering the worldMatrix is then send to the shader and won't be update then on every frame, the mesh is rendered using a shader with the given worldmatrix and because everything remains unchanged this is pretty well optimized Quote Link to comment Share on other sites More sharing options...
Dinkelborg Posted November 11, 2014 Author Share Posted November 11, 2014 Alright, thanks a lot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.