Edit Worldspace UI layer? - sorting

I need to have my worldspace UI render over my ceiling layer; however, there's no way to edit the render layer for the object. How can I fix this?

I believe you are looking for the Sorting Layer option in the Canvas component:
You can create a custom layer which renders on top of everything else like so:

Related

Not getting data from R3F useScroll because of zIndex

I'm trying to run an animation based on scroll in the background of a React app.
I use Threejs with React Three Fiber. In R3F, there is a hook called useScroll which I want to use.
Problem is that my Threejs scene (a Canvas) is in the background with zIndex: -100, so the scroll handler doesn't get the user input.
If I remove the zIndex property, everything works, but It's not what I want.
The scene look like this demo, the only difference is that mine has element in front.
I don't know if the solution is to use a different css style or something more complexe to allow the handler to do his job. I've been looking at React Portal but I don't think it will work.
Any ideas ?
Thanks in advance.

Suggested architecture to re-render scene only if scene has changed?

I have a complex web application, with several sub-views / widgets that add objects to the main scene.
Most simple THREE.js examples have a continous render loop, that re-renders the scene periodically.
This seems like a waste of ressources to me.
Therfore, I only want to re-render the scene if something has changed.
However, the sub-views / widgets do change things (like position of objects) in the scene on their own.
Is there something like a "scene.hasChanged" flag, that I can use to deceide if the scene needs to be rerendered? Or do I have to implement a parallel flag or notification structure myself?
Or is there another common solution to this?
Based on what you have written so far, it seems you have to implement a custom solution. Certain three.js examples like webgl_loader_gltf do not use an animation loop but utilize change events from the controls. The relevant line of code is
controls.addEventListener( 'change', render );
However, if more factors than just the user interaction trigger renderings, it's necessary to build some sort of notification/event system by yourself.
three.js R113

How to desaturate canvas group in Unity

How to get access to custom canvas group shader? I need to desaturate all child of game object situated on canvas. Something like canvas group component that provide possibility to change alpha of all child objets.
Unity might be using a more elegant solution by hiding their implementation of setting the alpha via the CanvasGroup component in their C++ part of the engine.
For now it looks like there is no other way than to set the material property on all UI elements (UnityEngine.UI.Graphic) with a custom material.
Remember, you can download the official shader source files. ;) There's a default UI shader, which you need to modify to add additional color functionality.

Avoid drawing of hidden components (FLEX)

We have big components to draw. Now we have performance problems. We are using visible and includeinlayout properties to hide some components, but they are still rendered by flex.
Is there a possibility to avoid that?!
Is it only possible if we delete the component from the displaylist or can we somehow override the draw method of the component and check if it is hidden or not and depending on that it will be drawn or not.??
Whatever components you don't want drawn yet, put in any SkinnableContainer based container with creationPolicy="none" (don't create my children for me automatically). Then later on ... if and when you want flex to create those components, you can do this:
// here frame is my container with creationPolicy="none" set on it
public function update():void{
if(frame && !frame.deferredContentCreated){
frame.createDeferredContent();
}
}

Sliding from One View to Another

How would I change from one view to another with a slide transition?
Thanks.
Place them side by side, and use NSViewAnimation to perform the animation.
This may turn out tricky if the views' size can change. Doubly so if the two views are not the same size as each other.
Marcus Zarra gives a good example of how to use Core Animation to achieve this effect in his post on how to implement a wizard. It's very simple to do using subviews and a CATransition.
Implement all the actual drawing using CALayers. (Having not used Core Animation myself, I can't get more specific.) Put them in a single view, hosting that layer hierarchy, and use Core Animation to perform the slide transition.
This may not work so well if the views are not display-only—that is, if they host controls that the user can interact with. Layers are more or less display-only, since you can't put a view in a layer, and only views, not layers, are responders.

Resources