Modifying rendered frames before they are displayed on HMD (i.e. filter)? - windows-mixed-reality

Would like to experiment with fading the display towards black as the pixels get further from the seat spot of the HMD; My natural instinct is for my eyes to track anything that appears to be viewable in the field of view meaning I inevitably look away from the seat spot and spoil the illusion - was thinking if the image faded away then it would be more natural to keep within the sweat spot...
Does WMR provide any way to modify rendered frames before they are output to the displays?

It seems you are looking for post-processing camera effects. It occurs after the camera draws the scene but before the scene is rendered on the screen. If you are developing WMR App via Unity, please see this link for
how to set up the components required to create post-processing effects in your scene: Post-processing
Besides, complicated post-processing on HMD devices is not recommended, because it is computationally expensive, and you might have large FPS drop, more information please see Avoid full-screen effects

Related

A good solution for a VR HUD?

I'm developing a game with THREEjs and webvr-boilerplate. I'm struggling a bit with how to properly render a HUD (score, distance, powerups etc) that always stays at the top of the scene. I've tried to have a plane (with a texture that's brought in from a hidden canvas element) but positioning it in space proves difficult since I can't match the right depth.
Any clues please? :)
Well, you shouldn't have a classic HUD, VR doesn't work like that.
You're searching for something called diegetic or spatial UI - that is the scores and other icons are rendered as geometry in scene space in a fixed position or distance (this one is called spatial UI). For best results, draw the information on some game object mimicking real displays, for example a fuel gauge on the dashboard of a car or visible remaining bullets on a gun (this one is called diegetic UI).
Unity has made a nice page describing these concepts.
I created a performance statistics HUD specifically for WebVR & THREE.js Projects.
https://github.com/Sean-Bradley/StatsVR
While the default setup shows specific information, you can modify it to show custom graphics and other data.
And if you don't believe me, just check out the
StatVR video tutorial.

How to draw carets for text input controls on double-buffered surface with GPU?

For example, when I have a complex view with the only thing actually changing is the caret, I don't want to redraw the whole scene just to update the caret.
For now the only reasonable way I can finger out to do this is to cache the content without the cursor. This doesn't seems to be a too bad one, but I have to choose between always render to texture or decide whether to render to texture or not all the time.
Maybe this problem can be generalized to "the right way to handle an almost-static complex scene with GPU".
My experience from working on a few games is to generally render the whole scene again. The cases where it is prohibitively expensive to re-render the resource every frame you implement the caching yourself. e.g. You cache a shadow map for a dynamic light until the light moves again.
The caching solution you described is what an automatic cache would have to anyways, so its not unreasonable. What concern do you have with rendering the whole scene again?

CreateJS Performance issue when rendering in a canvas that is displayed on mobile

I have a very specific issue. I am doing a demo in VR with three.js where I want to display 2D data. The data that will be displayed is dynamic (Text info) and needs to be animated.
Animate CC providing a nice suite of tools is an easy choice for this. With three.js, the way I found to add some 2D animation in the world, was to create a plane, add a texture from a canvas I created, which I update on RAF. No problem as of now.
The canvas I'm rendering is also the one that I create my stage from. Here the issue : Whatever the animation is (even an empty stage) I see a drop in framerate of about 15, as soon as I add the eventlistener on tick for the stage update. I tried many things (like not even adding the mesh, onto which I draw the canvas, to my scene) And If the eventlistener is added, I see my fps take a hit.
Whether the animation is "heavy" or not, I see this drop in framerate. And that drop is a big issue in VR since staying on 60 FPS is pretty much a must have at this point.
Any lead on what I could do to make this better ? Thank you !

Is there a way to pre-render a virtual panoramic scene?

I would like to put a photorealistic virtual scene on a tablet so when the user rotates the tablet, it shows as if the tablet is a window to an virtual world.
Pre-rendered scenes can be rendered photorealistic, while real-time rendering has a "computer-made look". Given that for one scene, the POV can be rotated but not translated in space, is it possible that a pre-rendered virtual panoramic scene give an immersive impression?
I doubt that this is easy, since rotating the view point will cause some sort of distortion. This kind of distortion is easy for apps like Starwalk, but difficult for photos. Can anyone point me out a direction?
I know that this will be tremendously easy for restricting motion in only one direction, but I would like the user to have a full 3d experience.
You need to either warp the photographs before applying them as textures to your "sky dome" or use non uniform texture coordinates. If done right this will even out most of the distortions giving a more realistic appearance.
Another alternative is to use more photographs so that you are only actually using the central area of each one.
I've found that http://code.google.com/p/panoramagl/ can render cubic, spherical and cylindrical panoramic images, so the problem transforms to how to make render a panorama which can be solved by stitching. I will still leave this answer open to see if anyone else has better answers.

How do I animate clouds?

I have 3 nice and puffy clouds I made in Photoshop, all the same size, now I would like to animate them so they appear like they were moving in the background. I want this animation to be the base background in all my scenes (menu,settings, score, game).
I'm using cocos2d, I have setup the menus and the buttons so the work but how do I accomplish this?
I was thinking to add this as a layer, any other suggestions?
Can anyone show me how some code how to make this please?
David H
A simple way to do it is with sine and cosine. Have slighly different parameters (period and amplitude) to ensure that the user doesn't realise (as easily) that they are programmatically animated.
You may also want to play with animating the opacity value. I'm not sure if layers have those, otherwise you'll have to add the clouds to separate nodes or images and applying it to them.
It's hard to be more specific without knowing what the images look like.
The simplest way to animate anything is to add the sprite to the scene, set the position and call something like...
[myClouds runAction:[CCMoveBy actionWithDuration:10 position:CGPointMake(200, 0)]];
This will slide the sprite 200px to the right over 10 seconds. As Srekel suggested, you can play around with some trig functions to get a more natural feel and motion paths, but you'll have to schedule a selector and iteratively reposition the elements.
The more difficult part of your questions is about getting the animation in the background of all scenes. Keep in mind that when you switch scenes, you're unloading one node hierarchy and loading a new one. The background cannot be shared. You CAN, however, duplicate the sprites and animation in all scenes, but when you transition between them there will be a jump.

Resources