|
Post by chuckterzian on Nov 28, 2021 14:49:51 GMT
Hello,
I'm trying to dissolve the book on showing or hiding it and the way the script currently appears to be set up the Skinned Mesh Renderer is only used on animations with stand ins using a Mesh Renderer for non-animated states. This makes it impossible for me to do a dissolve shader effect through a closing animation state and a book closed state because the different meshes are enabled and disabled through those states. Is is possible to get a modified script for this asset that just uses the Skinned Mesh renderer for all states of the book so that only one mesh renderer of the book is used and can therefore have a dissolve shader effect?
|
|
|
Post by echo17 on Nov 29, 2021 15:36:55 GMT
Unfortunately, the asset was designed with heavy integration of the stand-in meshes to improve performance, so there isn't a simple solution to undo that integration.
I might be misunderstanding the project requirement, but it would seem that if you set a shader on a material, then all meshes that share that material (animated or not) will use that same shader. That means the stand-ins will use the shader as well as the animated skinned mesh. See the SetMaterial method in the EnhancedBook script. This will replace the material in all meshes, skinned or stand-in. You just pass in the materialType (which is a book part of type MaterialEnum: BookCover, BookPageBack, etc) and a material, in this case your dissolve shader material. Something like:
book.SetMaterial(MaterialEnum.BookCover, myDissolveMaterial);
|
|
|
Post by chuckterzian on Dec 3, 2021 21:20:29 GMT
I appreciate the suggestion and I may be able to code something but with this particular dissolve material it makes the dissolve effect happen on the object level and not on the whole material level. I may be able to modify that since it's done with shader graph though.
|
|
|
Post by chuckterzian on Dec 3, 2021 21:38:21 GMT
Unfortunately, the asset was designed with heavy integration of the stand-in meshes to improve performance, so there isn't a simple solution to undo that integration. I might be misunderstanding the project requirement, but it would seem that if you set a shader on a material, then all meshes that share that material (animated or not) will use that same shader. That means the stand-ins will use the shader as well as the animated skinned mesh. See the SetMaterial method in the EnhancedBook script. This will replace the material in all meshes, skinned or stand-in. You just pass in the materialType (which is a book part of type MaterialEnum: BookCover, BookPageBack, etc) and a material, in this case your dissolve shader material. Something like: book.SetMaterial(MaterialEnum.BookCover, myDissolveMaterial);
What about having the book script turn off the renderers for the stand ins instead of enabling or disabling the game object? That would allow me to do calls to the object with the disabled renderer and then when the renderer is enabled it would be where I needed it to be in the dissolve process.
|
|
|
Post by echo17 on Dec 4, 2021 12:32:55 GMT
Sounds like a good place to start. Every project is going to have unique requirements, so for that reason I've included the source code that you can freely modify. For changing the renderer states, take a look at the following lines in EnhancedBook.cs (based on v1.9 of EnhancedBook):
560 566 1228 1236 1318 1517
I've virtualized the methods so that you can override them in an inherited class if you don't want to make changes each time you update the plugin.
You might also want to cache the stand-in renderers in the Initialize method so that you don't have to get the components each time you do your toggle.
|
|