This seems like a good question, I can’t think of a way off the top of my head. Tagging @John because I’m sure if there’s a way to do this currently, he’ll know.
I’ve also added a new example that performs this effect. It should be possible to drop into Codea with one caveat. For this to work the mesh has to have unique vertices for every triangle. Some smooth shaded models share vertices to make the mesh more efficient to render. I’ve added a function - craft.model:split() which lets you convert a model to have unique vertices, which will make it work.
Here is what it looks like in shade. You can combine this effect with lit and unlit shaders and use it on any input you like.
Excellent work @John ! Thanks for giving that a go. I’ll be digging in to what you have in Shade already, and look forward to updates and new tutorials.
@John, just want to say thanks again for including the wireframe example! To be able to go through the Shade nodes and see how you did it, and then compare that to the catlikecoding tutorial that was the inspiration, is all very instructive.
On a separate note - is the environment used in the Shade model preview (bottom right) easily reproducible in Craft? I’m sure its just a matter of getting the (sun) lighting correct and use Cameras - but just wondered if you already had it. I’m working through different algorithms for creating spheres (for my own knowledge - of course, they are built into Craft), and want to be able to preview 3D entities in Craft, a la Shade preview. In the built-in Craft examples there are a few that are close, but the Shade preview setup is exactly what I want.
Hey @John , just wanted to ask again about the Shade preview in Codea. I’m sure you have other priorities, but thought I’d ask.
(To deflect a little from my pesky resquest…)…I am very excited about Shade. Just wondering if this was a new project from the ground up, or were you able to leverage some code for the Codea baseline?
@iam3o5am Thanks for reminding me as this slipped my mind. The shade node UI and preview panel are actually running within the Codea runtime and written in Lua. The sidebar, menu and file browser are all UIKit native views and controls.
Here is the material preview boiled down into a Codea project. There is no camera interaction due to it being dependant on much larger chunks of code within Shade. It should be fairly either to hack it in using OrbitViewer or something similar. Hope this helps!