playMaker

Author Topic: wireframe shader + Playmaker Action  (Read 4446 times)

sama.van

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
    • Folio
wireframe shader + Playmaker Action
« on: August 22, 2011, 06:05:24 PM »
Hi!!

I am creating my portfolio as a 3D viewer for i-os.


Well, I found a cool script on "Unify" that create a new model for a wireframe shader.

The script wasn't able to set the color on iphone also some parts to fix.

A colleague did many modifications into the script + shader and here are both new files :


- http://a.samavan.com/WireframeShader/MeshRenderWireTest.js
- http://a.samavan.com/WireframeShader/Wireframe.shader


For now the script detect on the object owner to make it works.
And the script is a JS syntax and I cannot create a PM action with it...


I would be glad if someone could create PM action doing a conversion of the JS file to C...

About the attribute the best would be to allow the user choosing the targeted object and to extract the following variable at the beginning of the script as attribute :

- var lineColor : Color = Color.white;
- var lineWidth : float = 0.01;
- var lineDepthOffset : float = 0.1;


I can invite you to my Testflight update if you success to do something with it...
Most of my 3D work from my website is available!

And the final app will be free.


Thank you much!

sama.van

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12344
  • Official Playmaker Support
    • View Profile
Re: wireframe shader + Playmaker Action
« Reply #1 on: August 22, 2011, 11:34:42 PM »
Hi,

 Uhm. Interesting to see if OnRenderObject is doable within a playmaker action.

Maybe the easy way out would be to have this js script attached to your object, and control it from playmaker. Doesn't necessarily need to be a playmaker action. You can use sendMessage action or invoke as well.

 Would need to experiment on this. I'll get you something out for tonight for you to test and see if it fits your goal.


 Bye,

 Jean

sama.van

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
    • Folio
Re: wireframe shader + Playmaker Action
« Reply #2 on: August 22, 2011, 11:44:23 PM »
Maybe the easy way out would be to have this js script attached to your object, and control it from playmaker.

Yeah it was the main idea too.

But I think having a little bit more than 80 assets into the folio already imported and more will come.
Then to drop the script on each asset could take time!

About the viewer itself, I made a "viewer scene" I import every time the user choose a new scene with an asset.

For that reason I am not sure it could be a good idea to attach the JS script on this object on pre-production :(


Now, a PM action attaching the JS script on the object dynamically could work too...

What do you think?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12344
  • Official Playmaker Support
    • View Profile
Re: wireframe shader + Playmaker Action
« Reply #3 on: August 23, 2011, 12:19:43 AM »
Hi,

 Well. It seems you need some kind of micro framework. Like you said, it is possible to attach scripts and components to objects at runtime, it doesn't need to be hardcoded or done during production. Or you could create a prefab and in that prefab change the model and various settings. So in effect you have only one system that you duplicate at will.

Maybe if you could explain the way your viewer works, we could come up with something nice and tidy with playmaker. Send me a private message if you want some disclosure on this. I am fine with this.


 Bye,

 Jean

sama.van

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
    • Folio
Re: wireframe shader + Playmaker Action
« Reply #4 on: August 23, 2011, 01:13:56 AM »
Thank you!


To make it simple :

- I have many model with and without skin.
- Each models or set of models (if no skin) have their own scene.
- Inside each scene I keep some infos specific to each model like tri-count. animation-list etc (because playmaker doesn't handle list yet :()
- Each object is also tagged to be found by each script from the viewer scene.




===================

And I have a one more scene with all the viewer features like camera system, texture preview, model view (diffuse, no diffuse with litgh, checker, wireframe, etc..)
I import this scene every time you select a model ( = scene).




For that reason I would like to insert the wireframe script into the viewer scene to keep it very generic.


And to work with a prefab and change the mode under the prefab could create a problem because there are sometime more than one model into a scene, and if the model is skinned or not, the mesh info aren't stocked under the same node into the hierarchy :(

If you want, send to me an email you can check on your i-device (if you have one) and will attach you to the testflight.
And then you can see how it looks like.



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12344
  • Official Playmaker Support
    • View Profile
Re: wireframe shader + Playmaker Action
« Reply #5 on: August 23, 2011, 02:48:13 AM »
Hi,

 Well, handling arrays and that sort of things is something doable in playmaker, just needs some custom work and some tricks. 1.2 will definitly ease that aspect as well.

For example: instead of maintaining a list, we could simply maintain the array index and communicate with this instead. Also it's not impossible to write xml parsers in playmaker so that you can describe all your models meta data in a convenient manner.

 BTW, I use the same technic on iOS when I deal with large amount of confined data. I could not find a better way to handle memory management.

I'll be working on this custom action for you later on this evening. It's not a difficult thing, just need to run some tests with this onRenderObject thing first.


 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12344
  • Official Playmaker Support
    • View Profile
Re: wireframe shader + Playmaker Action
« Reply #6 on: August 23, 2011, 12:29:34 PM »
Hi,

 ok, I could not find a way to implement "OnRenderObject" within a playmaker action. So unless someone knows a way out of this, we need to create a link between a conventional script attached to the gameObject and a playmaker action so that we can achieve your OnRenderObject coupling.

 Are you ok to go down that route?

 Bye,

 Jean

sama.van

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
    • Folio
Re: wireframe shader + Playmaker Action
« Reply #7 on: August 23, 2011, 04:10:15 PM »
Also it's not impossible to write xml parsers in playmaker so that you can describe all your models meta data in a convenient manner.

Well if we can deal with XML, I will do a Mel-script from Maya to update it automatically each time I export an animation to Unity.
I already created a bunch of mel script function to parse&read and write with XML syntax for some other projects  :D

I can create and provide my script once the xml action will be ready!.  ;)

ok, I could not find a way to implement "OnRenderObject" within a playmaker action. So unless someone knows a way out of this, we need to create a link between a conventional script attached to the gameObject and a playmaker action so that we can achieve your OnRenderObject coupling.

 Are you ok to go down that route?

Does that mean we can also attach the script dynamically to the targeted object?
We could have :
- 0 - Get object with tag (already exist)
- 1 - To attach script dynamically to object (new)
- 2 - "OnRenderObject" to object. (new)

What do you think? Is that possible or not? ??? :-\
« Last Edit: August 23, 2011, 04:19:00 PM by sama.van »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12344
  • Official Playmaker Support
    • View Profile
Re: wireframe shader + Playmaker Action
« Reply #8 on: August 23, 2011, 10:23:17 PM »
Hi,

 Xml: way to go and would be a very cool thing to try implement in playmaker.

 Then yes, attaching scripts on the fly and all this is possible. Within playmaker, that would require some custom actions as well.

 Bye,

 Jean

sama.van

  • Playmaker Newbie
  • *
  • Posts: 19
    • View Profile
    • Folio
Re: wireframe shader + Playmaker Action
« Reply #9 on: August 26, 2011, 06:33:30 PM »
Hi!

Added a short description + video about the mini-project here :

http://hutonggames.com/playmakerforum/index.php?topic=630.0