Jump to content


Recommended Posts

Is there something like a window texture?


This could be similar to replacing a skybox with a plane where there would be a window.

It could function like a digital window in an city apartment showing a country side landscape. The picture based on the user's location and the rate of change could be based on how far the features in the picture are.

For example:

You could have 4 skyboxes, one within the other, each smaller than the latter.

Inside of all the skyboxes is your house/office/apartment or just a single window.

The window is a plane with the normals facing inward.

The texture for the window is based on the sky boxes, the inner most skybox image on top of the second and so on.

The section of image pulled from the skybox for the window texture is based on the plane's normals, the distance and angle of the user to the window, and the distance of each skybox to the window.

Info is pulled from the sky boxes but there are no active skyboxes

or with shapes that aren't boxes

Imagine yourself in a field and you are surrounded by mountains,

you take a beautiful panorama and isolate the mountains,

apply the mountains to a cylinder with no caps and flipped normals,

create a sky gif with clouds or stars floating by and apply that to a dome, cylinder section, or plane

and so on..



Link to comment
Share on other sites

Bartender... I'll have whatever Noyogi is having.  :)  Make it a double! 

Wow, what an envisioning!  Let's talk about a couple things.

4 hours ago, Noyogi said:

The section of image pulled from the skybox for the window texture is based on the plane's normals, the distance and angle of the user to the window, and the distance of each skybox to the window.

That... is a challenge... and it needs to be updated just as fast as the main camera can move.  The BJS renderTargetTexture (RTT) has some interesting power.  Here is our materials demo from the playground, but with 4 cameras, and 4 RTT's on planes, parented to the camera.  http://www.babylonjs-playground.com/#1WROZH#12

Essentially, an RTT allows you to use the view from a camera... as a texture.  Let's stop there, for a moment.

Know about layer masks?  Back to demo.  Each plane that is parented to the camera ... I call a "monitor", as in security-camera monitor.  The left-most monitor... is the view from camera 1, which is also the main camera.  OR IS IT?  Why can't we see the 4 security monitors... in monitor #1 (just like the main camera can see them)??

It is because...lines 79-124, which create the 4 monitors and its background plane... all are set to layerMask 1.  And notice in lines 14-17, all cameras are set layerMask 2.  LayerMask 2 cameras... won't render layerMask 1 mesh.  Cool, huh?   To top that off, look at lines 62, 67, 72, and 77.  We can set WHICH MESHES are displayed... for each RTT itself. 

So now we have TWO "mechanisms" for filtering/masking mesh in an RTT.  We can tell cameras which mesh to render, and we can tell RTT's which mesh to render.

Next, think about this, if you will.  Parent another camera to your main camera. (much like a stereoscopic camera "rig mode".)  Now build your wall/window (with a plane where the glass would be).  With the 2nd cam (the rtt cam), filter ALL mesh from its view... except the skybox.  When you have it right, cam2 RTT should be a picture of skybox/clouds... and since it is copying cam 1 orientations... those clouds should pan-around when cam 1 pans-around, etc.  Now just install that cam 2 RTT... as a texture on the window glass plane.

You're off and running... off to see how demented you can get.  ;)  Some very strange things could appear to happen... outside that window.  heh  (house appears to turn along-with players head)  :)

One minor issue.  Notice that the main cam is using some edgesRendering... a post-process thing.  RTT's get their camera image BEFORE post-processing, and thus we don't see edgesRendering in monitor 1 (RTT 1).

RenderTargetTextures opens some doors (windows?), though.  Your "big view" is within reach (if its not fake).  Start simple, do some checks, try some stuff.  Put yourself in a box with no holes for windows, and see what you can fake.  :)  Share, if ya please.  Others may comment soon.  Good crazy thinkin', Noyogi!  Let's try all of it. 

Link to comment
Share on other sites

@Wingnut will have some juice of lime squeezed freshly into a cup with some sugar water and carbonated mineral water, thank you bartender.



it seems the issue here is that the monitors/windows are displaying the entirety of the rtt cameras' fov's, rather than only what looking through the window would allow, any ideas on how to change that?

Link to comment
Share on other sites

Lime juice?  How uneventful.  :)

(Wingy adds a big pile of whipped cream... atop his lime juice, and sprinkles-on edible glitter)

Yeah, um... me thinks you need to move the rtt cameras... to a .position just behind each window.  Maybe?

Your vision is so damned big, my brain is having a difficult time holding it in view.  :)

Maybe the rtt camera for a given window, should be just outside that window (aiming at skybox).  But yeah, .fov and .fovMode could be important here.  .fovMode is used to determine if .fov should be applied to height, or to width... I think.  Forum search link.  Also, I don't know what happens when a camera is set to orthogonal mode, but that might be worth studying, too.

In general, though, there's all sorts of trickery and foolery available.  There's some extra things that you would need.  For example, as player moves around inside the house-o-fake-windows, what do the rtt images do?  Do they scroll a tiny bit?  Do you need to slightly rotate the rtt cams... so they show a slightly different section of the skybox images?  Little things... calibrating.  That's how you would get the best fakery.  :)

And, you can make your windowed walls out of 4 planes, so there's a REAL hole in the middle.  Or use CSG and boolean-subtract a hole into a wall.  But, there's still something cool about fake windows that are actually big-screen TV's, eh?  Don't try to stick your head out-of one, though... and avoid spitting chewing tobacco out of those fake windows.  heh   [fun!]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...