I’ve tried everything I can think of to hard code a specific object into rendering as a wireframe and nothing is working. Can someone provide the requirements to this?
Basically I find the object:
var objRose1 = this.app.root.findByName(“Rose1”);
Then tried setting the objRose1.render.renderStyle = pc.RENDERSTYLE_WIREFRAME;
Which does set to ‘1’, but there is no change in the visible model.
Also tried objRose1.render.meshInstances[0].renderStyle
= pc.RENDERSTYLE_WIREFRAME;
Same result. The value changes from 0 to 1, but there is no visibile change to the object.
I then tried clearing the material, which does nothing to the render object, but give an error when clearing it from the mesh instance. The engine auto corrects that error by applying a default material itself. This object then does show in a new color, but still no wireframe.
Then I tried the ‘GenerateWireframe()’, function which was found in some older help topics. But was shown inconjunction with the older ‘model’ type of object. This doesn’t work against a render object.
Any additional tips would be greatly appreciated.
This is just to see a model in wireframe form. I am trying to make a product configurator and would like the default view of the various objects to be in a wireframe style until the user makes a selection. But I can’t even write that user interface until I get something to show as a wireframe.
Thanks
This should work, I tried it in this example (see the added line): PlayCanvas Examples
I assume you use render components, and not model components in your scene?
Thank you for providing that bit of code. I added the shapes to my project but the wireframe still isn’t showing. Maybe this is because the project was started from a ‘Model View’ template. anyway, here is my results using the same shape logic you provided.
https://playcanvas.com/project/1316168/overview/model-viewer
You have a typo.
entity.render.renderstyle = pc.RENDERSTYLE_WIREFRAME;
Should be
entity.render.renderStyle = pc.RENDERSTYLE_WIREFRAME;
Note the uppercase S
in Style
2 Likes
When your right, your right!! That change allowed the shapes to become wireframes!! Yay! Now why wont my model become a wireframe? Any ideas?
I find the object: let objRose1 = this.app.root.findByName(“Rose1”);
Then change the renderStyle: objRose1.render.renderStyle = pc.RENDERSTYLE_WIREFRAME;
But there is no visible change to the results. Does it matter that the ‘Rose1’ object is a sub object under the ‘mort lock’?? I wouldn’t think so as the rose1 has it’s own renderStyle property.
Looks like a wireframe to me
1 Like
Let me in on the secret. I’m dying over here. What exactly did you do? And if you say you just ran my app, then I need to know what type of computer you have and what browser your using. Pretty please…
I just ran your app.
Macbook Pro M1 Max. Chrome
CHROME!!! I just tried on Chrome and guess what - it’s a wireframe! My main browser is ‘Brave’. Ugh!! Thanks so much
That’s odd
Brave uses Chromium under the hood so it should render the same.
I wonder if Brave’s privacy features is causing an issue with scripts/webgl rendering or WebGL feature reporting (via anti-fingerprinting features)
I’ll keep playing with it… There is a way to disable Braves security fetaures ‘per site’. So I’ll continue messing around with my app. Thanks again!!
I think it’s possible my eyes weren’t seeing the wireframe due to the Satin Chrome material being applied by default. Plus the model I chose to test with has no real big faces. Sheesh. So I’m now removing all material by default until the user selects one. Thanks again.