
A browser plugin for Unity - imoldfella
https://blog.mozvr.com/a-browser-plugin-for-unity/
======
nwah1
You can also render Unity inside of Firefox. Infinite recursion potential.

~~~
wtmt
_F_ irefox _U_ nity _B_ rowser _A_ ddon _R_ enderer?

~~~
high_density
with web-assembly, we might get:

Firefox in Unreal in Firefox in Unity in Firefox...

------
chrismorgan
The current title here on HN of “Firefox in Unity” is incorrect. This is based
on Servo, not Firefox. From what I understand as a very casual observer that
hasn’t been keeping up with things, Servo’s architecture is rather more
conducive to this application both in embedding convenience and rendering,
being able to render pages in a way that will make them perfect quality
regardless of your 3D perspective, whereas I imagine Firefox _might_ still be
at the “rasterise the viewport and use it as a tile” level, though maybe
WebRender (applying Servo’s renderer to Firefox) has resolved that? As I say,
I haven’t been keeping up with things. Anyway, the correct title for the
article is “A browser plugin for Unity”.

~~~
dang
Ok, we've changed the title to what the article says.

" _Please use the original title, unless it is misleading or linkbait; don 't
editorialize._"

[https://news.ycombinator.com/newsguidelines.html](https://news.ycombinator.com/newsguidelines.html)

~~~
andybak
Whilst I understand the motivation behind this guideline, it seems to be
applied with little regards for it's usefulness.

Post titles need more context than the original article title because posting
to HN strips out most of that original context.

~~~
dang
You probably have that perception because cases that you dislike stand out
like sore thumbs, while all the other title edits escape notice. If you think
about it, that pretty well guarantees the feeling "it seems to be applied with
little regards for it's usefulness"—because all the "useful" edits are by
definition excluded.

You can use petercooper's title edit tracker to see some of them:
[https://hackernewstitles.netlify.app/](https://hackernewstitles.netlify.app/).
It doesn't show all of them, and it doesn't distinguish between edits by
submitters and edits by mods. Probably we should just publish the official
list—I feel like title editing is the most consistent and easily defensible
thing we do.

~~~
andybak
Thanks for the reply.

What do you feel would be the harm if the policy was modified to

> "Please use the original title, unless it is misleading or linkbait or lacks
> sufficient context; don't editorialize."

It just seems like there's frequently times when the original title is
completely baffling out of situ.

~~~
dang
The issue there is that sometimes a little bafflement is a good thing. Not too
much, not too often, but enough to make readers work a little:
[https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...](https://hn.algolia.com/?dateRange=all&page=0&prefix=true&query=by%3Adang%20%22work%20a%20little%22&sort=byDate&type=comment).
It slows the mind down and makes it engage a bit in figuring-things-out mode,
which is good for curiosity. I think it's a valuable mechanism for
interrupting the internet reflex brain, with its rapid reactions to literally
everything, that mostly governs us online.

------
meesterdude
This is something I've wanted for years, for numerous uses like collaboration,
Method of loci, and documentation. Overlaying our built-in spatial awareness
with focused data is an area of information architecture with a lot of
untapped potential.

there is also this which allows multiple windows within unity (there's a demo
you can try): [https://zenfulcrum.com/browser](https://zenfulcrum.com/browser)

~~~
chrisweekly
"Overlaying our built-in spatial awareness with focused data is an area of
information architecture with a lot of untapped potential."

+1 for this; couldn't agree more

------
Guest81
This seems similar to ZFBrowser which implements chromium in unity, and is
used by Tabletop Simulator. I wonder how the performance compares?

------
ourcat
I remember when this sort of functionality arrived in Second Life.

It enabled a lot of easy 'shared experiences'. eg: Watching a live video
stream of an event with people, or group presentations etc.

~~~
Animats
Yes. SL launches an instance of Chromium as a subprocess in the viewer for
each object face that's an HTTP browser. I wonder if Servo could do that with
less overhead.

------
robterrell
As the author of the first web browser plugin for Unity (HTMLTexture) I must
say I'm very impressed by this. Kudos.

Sounds like Unity has changed enough under the hood that the technique I used
(calling gl_bind() behind Unity's back, using the texture ID you pass in, to
basically write to the texture Unity is using for your mesh) no longer works.

------
callumprentice
For anyone else looking to embed a modern browser in their
Windows/macOS/Linux* C++ application, you might consider Dullahan: source:
[https://bitbucket.org/lindenlab/dullahan/src/master/](https://bitbucket.org/lindenlab/dullahan/src/master/)
and example screenshot:
[https://bitbucket.org/lindenlab/dullahan/raw/master/docs/web...](https://bitbucket.org/lindenlab/dullahan/raw/master/docs/webcube.png)

I recently updated it to use Chromium 81 and would have updated it to the most
recent version (84) if there weren't some non-trivial changes needed to make
video/audio streaming work again.

It's what we use in Second Life and would welcome other users' comments to
help improve it.

------
dleslie
What are the security guarantees about this?

~~~
devwastaken
Exactly this. Vrchat had chromium for a while, but exploits got it removed.
Itd be great if it was just a static browser engine, no Js, with a strong
sandbox. So at most all that can be done is messing with the browsers runtime
memory itself, not the system it's on.

~~~
mhh__
What kind of exploits? Was the browser not isolated at all or was it (say)
sandbox-escaping via the JS?

~~~
dleslie
We posted this:

[https://medium.com/@vrchat/security-update-web-
panels-4699fa...](https://medium.com/@vrchat/security-update-web-
panels-4699fa0be103)

It was severe enough that I ripped them out, though we were unable to find any
evidence of the vulnerability in use.

~~~
mmmkkaaayy
But what was the vulnerability? It's not mentioned in the post.

~~~
dleslie
It's been a few years, and I can't recall the specifics with certainty. It was
a serious Chromium SVE that was unpatched in the middleware we were using.

------
gfxgirl
I'm sure having a browser in game as a million uses but ...

Oculus Rift has in game browser built into their OS. In any game and any time
I can pull up a browser in VR (or any desktop app). Pin a walkthru up. Pin up
video chat with a friend.

It seems like browser in VR would be better served at an OS level. The OS
could provide a way for the app to request VR be placed in the scene. Ideally
it happens in a way the app can't look at the screen since a game shouldn't be
able to look at the contents of your browser window.

------
jayd16
>As we do not have control over the binding of the texture and the Unity
context, the current design for updating this texture uses a blit (copy) via
Servo’s surfman-chains API

I don't think this is necessary. You should be able to make Texture objects
that ref existing native textures in Unity and I've been able to use
OES_EGL_image_external extensions to sample Android decoded video textures
sampled from Unity shaders.

Its not the most widely available option but the perf is much better.

~~~
phil_moz
The issue is not access to an external texture, it's access to an external
texture on the right thread in the right GL context. We did look at writing a
new backend for surfman to integrate directly, but it's a bit of work and not
at all cross-platform, so this was not a goal of the project at this stage.
I'd like to find a way to avoid the blit though, so I'm continuing to
experiment in this direction.

------
arendtio
What is wrong when something cool like this triggers a response along the
lines of 'finally I can get tracked while being in-game'?

------
twoodfin
I’m a little disappointed the WebGL demo didn’t show what happens when the
“outer” viewport moves.

------
bzb3
More like Servo in Unity... And from what I recall, Servo is not even an alpha
at this point

~~~
tashoecraft
I don’t believe servo is ever intended to be more then a testbed for
integrating components into Firefox core. It’s modular, and pieces of it have
already been merged and are used in Firefox. So my interpretation of this is
that they are using their more modern code to test out this feature and if
it’s solid enough and useful enough it can be pulled into core.

~~~
mook
I thought they _originally_ intended for servo to perhaps someday be its own
thing; I had this impression specifically because I think they had at some
point aspirations for servo to have a stable embedding API (to let other
applications use it as a rendering engine). Of course I don't think that's the
case anymore.

~~~
chrismorgan
There was explicitly never any plan for Servo to be a product on its own. Note
that this does _not_ mean that there was an explicit plan for Servo never to
be a product.

