WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-26-2016, 11:00 AM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
viz.COPY_SHARED_MATERIAL_HINT not working

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!
Attached Files
File Type: zip oil_pump.zip (164.3 KB, 656 views)
Reply With Quote
  #2  
Old 08-28-2016, 02:11 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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')
Reply With Quote
  #3  
Old 08-29-2016, 08:52 AM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
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!
Reply With Quote
  #4  
Old 08-29-2016, 08:59 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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?
Reply With Quote
  #5  
Old 08-29-2016, 11:17 AM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
Just uploaded (ref #1634110).
The original model was created using 3DS Max v12 and your osgb exporter plug-in.
Reply With Quote
  #6  
Old 08-30-2016, 01:36 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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.
Reply With Quote
  #7  
Old 08-30-2016, 07:27 AM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
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).
Reply With Quote
  #8  
Old 09-02-2016, 05:42 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The command works when saving out the model directly. What are the modifications you are wanting to make in Inspector before saving it out?
Reply With Quote
  #9  
Old 09-02-2016, 07:43 AM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
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)?
Reply With Quote
  #10  
Old 09-08-2016, 01:22 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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.
Reply With Quote
  #11  
Old 09-09-2016, 09:12 AM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
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.
Reply With Quote
  #12  
Old 09-13-2016, 12:52 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
If you have not, update to Vizard 5.6 which was recently released. The fix is included there.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue Getting Quad Buffer Working nabrahamson Vizard 2 08-30-2012 09:43 AM
win32ui winviz.exe has stopped working TarkaDahl Vizard 3 08-10-2010 05:19 PM
ppt 3/4 working sisun1030 Precision Position Tracker (PPT) 6 03-05-2010 09:11 AM
Flock of Birds (Only Position Tracking working? No Orientation?) TheLostBrain Vizard 6 05-10-2008 08:39 AM
Collision with avatars and scene not working JvdBosch Vizard 12 09-14-2006 06:01 PM


All times are GMT -7. The time now is 12:14 AM.


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