by JusticeJuice · 5y ago · 0 comments
There's lots of good reasons to semantically want to embed a 3d model in a page, like any other type of media. Say you're writing a course explaining how differential gears work - a 3d model of that could be really handy to look at to learn. A shoe company wanting to have a model of their sneakers in their shop.
Sure we've got canvas, and WebGL, and WebGPU, and libraries like three.js, which work. But wow you gotta get a lot of JS slapped together to just get something rendering. E.g. I wonder how long transit spent getting a truck rendering on this page. https://panic.com/transmit/
The other challenge of doing everything yourself is that code is stuck in time. It's going to get very minimal benefits from browsers and devices getting better over time, it won't get native UI changes - in 5 years it'll look very dated, if it's still accessible.
A model element makes a lot of sense to me.
The spec text even says that the lighting environment will come at a later date. So, no, you don't seemingly have any control over one of the most important parts that makes the visuals of your scene. Even VRML could do that.
Also seemingly no word on the camera position, or FOV, or anything else.
So it doesn't seem feasible to get even remotely matching renders, at which point, why bother?
the goal isn't to fully render scenes, it's simply to gain the ability to include a 3d resource in the page semantically. heavier solutions to render scenes already exist.
You see where this is going right?
Ways of navigating a 3D model also vary wildly. Sometimes you just want to pivot/rotate them around a little, but sometimes "walking" inside them makes more sense.
Then there are materials and lights, and here people go wild with ideas.
In our "current world", if you want a 3D viewer, you use WebGL and Javascript, and voila, what you get is what you see in all browsers that support WebGL.
> But wow you gotta get a lot of JS slapped together to just get something rendering
Indeed. But there are some quite nice 3D model viewers out there ready to roll, easy to embed, and full of features.
Now with native video, there are still precious few instances where it's just the browser's native video widget. In basically all serious commercial scenarios, there's at least custom player chrome, navigation buttons, overlays, JavaScript to pause the video and play an unskippable interstitial, etc etc.
I would argue that the current state of affairs for 3D viewers is closer to the current state of affairs for video than it is to the Flash player story of 15 years ago. No, there is no explicit "model viewer" widget, but you could just as easily argue that WebGL canvas is to 3D content what <video> is to h264 and webm content.
Under "Considered Alternatives" [0]
> 4. Do not add a new element. Pass enough data to WebGL to render accurately
> As noted above, this would require any site that wants to use an AR experience to request and have the user trust that site enough to allow them access to the camera stream as well as other information. A new element allows this use case without requiring the user to make that decision.
[0] https://github.com/WebKit/explainers/tree/main/model#conside...
Another issue is that it’s inevitable that support for fragment and vertex shaders will be added, which is another huge issue (MS put-off supporting WebGL for years out of plausibly legitimate concerns about possible vulnerabilities in WebGL shaders).
…of course that’s all fine on Apple’s uniform hardware: fingerprinting MacBook users with their identical GPUs will be harder compared to PC users with their huge matrix of possible GPU chipsets, GPU drivers, and GPU performance/quality settings - which all affect how simple 3D models are rendered.
[0]https://docs.microsoft.com/en-us/dotnet/api/system.windows.m...
But then I thought, maybe they're niche because something like this doesn't already exist
IMO it should only be considered if there are challenges with flattening the data in question. For example, if the data represents an actual scanned 3D object.
On the other hand, rendering arbitrary data as "3D" models is usually a cute waste of time. There are much more effective ways to explore and analyze it.
https://addons.mozilla.org/en-US/firefox/addon/decentraleyes...
Maybe you'd like to display a "model" of a city. Oh, too big, needs to be streamed, LODed, etc. Maybe you'd like to display a "model" of a forest. Oh, well, you need a terrain renderer that dynamically generates geometry from height data plus you need a specialized renderer to render the grass and bushes else the frame rate will be 1fps. You'd like to display a "model" of Waikiki Beach at sunset and you'd like to use a water shader with a sunset and reflections. You'd like to display a "model" of the Los Angeles mountains as viewed from downtown Los Angeles, complete with atmospheric ray scattering to convey the air quality. You'd like to render a fur covered animal and render fur, not just a texture. You'd like to render a "model" of a person with realistic hair. You'd like to render a "model" of wax candle with subsurface scattering so it actually looks like a candle. You'd like to render a "model" of camera lenses to explain refraction so you'd actually like them to refract.
Engines like Unreal and Unity let you change the way they render because every situation requires different solutions. No generic "render a model" covers rendering all models. An API like WebGPU/WebGL lets devs add what they need.
Oh, you say, we'll just add features to cover those use cases. Now Chrome will have features A,B,C, Firefox, A,B,D, Safari B,E. That will be hell for devs. An API lets people write libraries with features they need that work in all browsers. They don't have to wait for the magic day N years from now that all browsers finally add the feature they want.
Further, people will keep requesting non-3D features "I want to have an <input type="text"> in my scene". "I want to have a <canvas> in my scene" that I can draw on in realtime. "I want to have a model that displays a <canvas> in my model so people can draw logos on their avatar's t-shirts". I want to play sounds in 3D from specific points in my model, etc. until this "model tag" has all of HTML and all of JavaScript inside
Again, this is all better solved with APIs instead of trying to cram more and more and more features into a single tag.
> The other challenge of doing everything yourself is that code is stuck in time. It's going to get very minimal benefits from browsers and devices getting better over time, it won't get native UI changes - in 5 years it'll look very dated, if it's still accessible.
And neither will a model tag. In fact it will be worse. First off, when I put a model on my page, I want it to look they way I or my artist created it. I don't want it to change over time based on someone else's idea of how it should look.
Yay! OpenGL with extensions all over again
https://webglreport.com/?v=2 reports 10 extensions.
And you can get the full spectrum over GL, GL ES and Vulkan, here https://gpuinfo.org.
Or you can just model your item in solvespace (or link an STL file) and export it as HTML. Done.
https://solvespace.com/index.pl
Examples: http://m-labs.hk/software/solvespace/
HN uses purely native components and it's one of the best websites I regularly visit. Fast, responsive, works on every device. I can't help but feel like web developers recreating native components are doing so out of incompetence or complete disregard of usability.
I'm a front-end developer, and I currently work with one of the best UI designers in the industry (she's really, incredibly good). We consistently get very positive feedback on our work - currently rebuilding the front-end UI for a unicorn SaaS startup.
Good UI controls take a lot of work on small details even beyond the design mocks - event handling, styling, keyboard navigability, layout behavior, configurable options... but when it all comes together it feels great to use.
What are you talking about? The vast majority of sites use native input elements.
The percentages are going to be different, though, depending on whether you're talking about text boxes, dropdowns, or date pickers. (After all, Safari only introduced native support for date pickers this past April, according to MDN's compatibility table [1].)
[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/in...
This is definitely not true. Not even close.