WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   viz.COPY_SHARED_MATERIAL_HINT not working (https://forum.worldviz.com/showthread.php?t=5828)

tokola 08-26-2016 11:00 AM

viz.COPY_SHARED_MATERIAL_HINT not working
 
1 Attachment(s)
Hi Jeff,

I've come across this very irritating issue of the viz.COPY_SHARED_MATERIAL_HINT command not working. I have a very simple model and have moved things around just in case, but the command fails to do what it's supposed to (create copies of the same material). Whenever I try to change alpha value of one node, the second one using the second material changes to. Weirdly enough, I've use this in other cases with no problem.

I couldn't attach the model (bigger than 1MB) but here's the simple code:
Code:

object = factory.add('models/blue_tanks.osgb')
object.hint(viz.COPY_SHARED_MATERIAL_HINT)
object.alpha(0, 'OilDrop1')

Update: I actually created this with the Inspector from a 3DS model. Running the code on the original model is fine. Eventually, the Inspector does something that renders this command useless. Additionally, it increases the size by 8-10 times more than the original file (attached)! It's kind of strange that WorldViz' own 3D software affects models in such a way. Is there a work around (instead of using 3DS again)?

Thanks!

Jeff 08-28-2016 02:11 AM

I ran both of the following scripts with the attached model and it worked. Only the alpha of one sub-part was changed. Does it only happen when you parent the object to your factory model?

Here is the object loaded on it's own:

Code:

import viz
viz.go()

object = viz.addChild('oil_pump.osgb')
object.hint(viz.COPY_SHARED_MATERIAL_HINT)
object.alpha(0, 'OilDrop1')

Here is the object parented to the ground model:

Code:

import viz
viz.go()

ground = viz.addChild('ground.osgb')
object = viz.addChild('oil_pump.osgb')
object.setParent(ground)
object.hint(viz.COPY_SHARED_MATERIAL_HINT)
object.alpha(0, 'OilDrop1')


tokola 08-29-2016 08:52 AM

Jeff,
sorry it wasn't clear, but as I said in my original post I could NOT attach the problematic model created (save as) from the Vizard Inspector. The zipped model is more than 1MB, which exceeds the forum's limitation. I've tried adding the model by itself as well and the problem persists. Something happened during the saving process and the shared_material command does not work.

Let me know if I can send it some other way. Also, I'm not sure if the increase in size is normal (the 703KB file became 5.7MB as soon as I saved it with the Inspector).

Thanks!

Jeff 08-29-2016 08:59 AM

Yes, you can upload it here. Please include both the original 3DS model and OSGB model saved out from Inspector. How did you create the attached OSGB model that does work?

tokola 08-29-2016 11:17 AM

Just uploaded (ref #1634110).
The original model was created using 3DS Max v12 and your osgb exporter plug-in.

Jeff 08-30-2016 01:36 AM

Did you also upload the original exported model? If not, can you upload that as well. The model 'oil_pump.osgb' has no textures saved with it while 'blue_tanks.osgb' does and their scenegraphs appear different.

tokola 08-30-2016 07:27 AM

The oil_pump.osgb is the original exported model. I just chose to save the textures as images to keep the file sizes low. I am sure this shouldn't affect the command. Also, I slightly altered the scenegraph of the blue_tanks model in my attempt to make the command work. I basically removed the 'OilDrop' node. You can Save as... yourself from the original to maintain the original structure.

If you believe the textures might affect anything during saving a copy, I uploaded them as a zip file (ref #1634470).

Jeff 09-02-2016 05:42 AM

The command works when saving out the model directly. What are the modifications you are wanting to make in Inspector before saving it out?

tokola 09-02-2016 07:43 AM

Yes, I noticed it only works with direct export. I'd like to delete some nodes and change some material. I don't have 3DS installed any more and try to avoid the hassle for these minor modifications. Is it possible? What does Inspector affect and the model does not behave properly with Vizard command(s)?

Jeff 09-08-2016 01:22 AM

Thanks for finding this. It looks like there is an issue with the command when the scenegraph above the node is modified. This will be fixed in the next release.

tokola 09-09-2016 09:12 AM

You're welcome Jeff. I'm glad I could give back to WorldViz a little bit:)
I guess I'll have to bite the bullet and re-install 3DS until you fix this.

Jeff 09-13-2016 12:52 AM

If you have not, update to Vizard 5.6 which was recently released. The fix is included there.


All times are GMT -7. The time now is 03:31 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC