Tutorialempty Spaces The Blog



The following optimization areas are ordered by severity, so you shouldn't think about fill rate or pixel shader cost if your scene is full of small lights that could be optimized.

The grass shader works 100% on the GPU, each material draws all blades of grass at once. This is great performance wise, as long as this performance is done as few times as possible. Ideally deferred rendering could be used, where it would only be drawn once per camera and once per shadow caster. However deferred rendering makes it impossible to use different lighting modes or subsurface scattering, so here are a few tips for improving performance in forward rendering:

  1. Reduce the number of lights that affect the material. Each light source will cause the grass to be re-rendered. You could set the culling mask of the grass material, to specifically exclude the grass from some lights.
  2. Reduce shadow casters. As with lights, each time the grass casts shadows, the whole area will be rerendered. This is also true in deferred rendering. Either disable shadow casting on the material or use as little shadow casters as possible.
  3. Reduce shadow cascades. Each shadow cascade causes an additional draw call, so in practice 4 shadow cascades quadruple the performance cost of the shader.
  4. If your scene includes many small light sources and you can't use deferred rendering, try to split up your grass area into smaller areas. This will increase the draw calls for directional lights, but it will reduce the amount of grass that will have to be rendered per light source and make the individual draw calls smaller. With some experimentation, this could help improve performance.

Whether you have a team or want to grow one, Squarespace lets you add contributors and set individual permissions so you can turn your blog into a publication. Socially Connected Your blog is the center of your online identity. You can specify the spacing on columns/rows in the grid (including those that contain no widget) by running the gridcolumnconfigureand gridrowconfiguremethods on the parent of the widgets (in this case, the parent would be root). For example, to set a minimum width for the 4th column, add the last line to your code: import Tkinter as tk. Jan 10, 2021 New York City, New York, United States About Blog SPACE.com is the leading space news site on the web keeping up on the latest space science, technology and astronomy news. From satellites to stars, NASA information, astronomy, the sun and the planets, this blog has the information. Frequency 6 posts / dayAlso in Science Blogs Blog space.com. The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 350 open source projects, including runtimes, tools and frameworks.

Tutorial Empty Spaces The Blog Example

The most performance costly part of the DirectX 11 Grass Shader is generating each blade of grass. While it is still magnitudes faster than on the CPU, the easiest way to improve performance is to simply reduce the polygons. Here are a few rules you should follow:

  1. Use the Target Density to set the maximum density, in the closest areas to the camera. If the Target Density is maxed out before you reach your goal, use mesh normalization and subdivision to increase the maximum possible density. Don't set the Target Density higher than your mesh can support, this will lead to unwanted behavior.
  2. The 3 other density settings can be used to change the grass falloff. Try to draw as little grass in the distance as possible. High density in the distance consumes more performance, as there is more area to cover. Keep the dense area small and centered around your camera. Use the floor texture to hide the missing grass.
  3. Instead of using very small blades of grass, either use an art style that works with wide grass or bundle together multiple smaller blades of grass. You don't have to make billboards, but using a texture to represent 5-10 small blades of grass can work great as a tradeoff between performance and visuals. You can use the texture atlas tool to automatically combine multiple blades of grass.
  4. Do not use the Randomized Grass Orientation mode, in this mode each blade of grass must render a front and a back side, doubling the number of triangles. However, you can ignore this tip in case you are using deferred rendering. There the benefit of only having to render the grass once, instead of per light source, likely outweighs the cost of randomizing grass orientations.

The triangles of each blade of grass have to be filled with pixel information on the GPU. This cost is minor compared to the topics above, however, if you are using a high amount of very large billboards, it could become a limitation. Either use a large number of small blades of grass or a smaller amount of large blades of grass.

Also try not to waste any texture space, try to create your textures like the right side, not like the left:

Different lighting models and shader features can have different performance costs. You should use the least costly lighting mode that is compatible with your art style. For example, if you don't need specular highlights, you should use the Unshaded lighting mode, if you don't use lights at all, you should use the Unlit lighting mode. Only enable texture atlases if you are actually using them.

Tutorialempty Spaces The BlogBlog

This is a last resort of optimization, you should always concentrate on the topics above first, however, you could gain some milliseconds for free if your art style allows it.

Make sure the shader is not in 'Always Included'

There have been cases where a background script automatically moved one of the grass shaders (Grass.shader, Grass Forward Only, or Grass URP) in the 'Always Included' list in Project Settings > Graphics. When the shader is in there, all variants will be compiled, which can take weeks.

Skip unused shader features

Make sure the 'Skip unsused shader_feature' is enabled on all variations of the grass shader in your project, e.g. Grass.shader, Grass Forward Only, or Grass URP.

Strip unused shader instances

Go to Project Settings > Graphics, then make sure that instance stripping is enables.

Use a shader stripping tool

If Unity's shader compiler is still unable to reduce the shader compilation times to acceptable levels, it can be necessary to use an additional shader stripping tool. You can either create one yourself, by following the blog post by Unity, or use a ready made tool, like the UnityShaderStripper. For example by following this guide.

I am not a developer of the Shader Stripper tool, so I can't provide support for it. If you have any problems, please contact their developers. If you have tips that may help other developers, please contact me through the contact form and I will share them here!

Tutorialempty Spaces The Blog Example

With shader keywords, it’s possible to switch between multiple variants of a single, large shader. More info in the Unity documentation.

Empty

While this does not actually affect the performance of the shader, it can change the compile times. In some cases, Unity could even not compile at all, because of too many keywords.

To remove shader keywords, open the Grass.shader file and search for the shader-feature blocks:

If you want to remove a keyword, replace the shader_feature line like this:

You can replace one, or multiple lines, but they have to be identical in every shader_feature block in the shader. ' __ ' is an empty keyword, which can be used to switch a single feature on or off. If you want to disable a keyword using it, just don’t create a #define line, like shown with the NO_TESSELLATION_SMOOTHING keyword above.

There are multiple shader feature blocks per shader file, make sure all of them are identical.

Home » Eclipse Projects » Sirius » Custom Layout for Containers
Show:Today's Messages::Show Polls::Message Navigator
Custom Layout for Containers[message #1403830]Mon, 28 July 2014 08:03
Aleksandar Kanchev
Messages: 4
Registered: July 2014
Hello, I'm new to creating diagram editors using frameworks like GMF and Sirius. However it looks quite easy creating diagram editors with Sirius, so we're giving it a try in our project. Currently we have a problem where we need a container with an advanced layout. Our goal could be achieved by chaining small containers together with the currently available layouts but this will complicate the graphical model and there are concerns about maintainability and performance.
One very nice solution would be if we could define our own layout manager, which would take care of the positions of the contained child nodes. Since we're new to Sirius (and GMF) we couldn't easily find the place where we could just plug our custom layout provider. I was hoping that someone with more experience might point us to the right direction or even better provide us with an example. Thanks!
Re: Custom Layout for Containers[message #1404011 is a reply to message #1403830]Tue, 29 July 2014 07:25
Florian Barbin
Messages: 253
Registered: August 2010
Hi Aleksandar,
Take a look on this post which is similar to your need:
https://www.eclipse.org/forums/index.php/mv/msg/639946/1234795/#msg_1234795
Regards,
Florian
On 07/28/2014 07:02 PM, Aleksandar Kanchev wrote:
> Hello, I'm new to creating diagram editors using frameworks like GMF and
> Sirius. However it looks quite easy creating diagram editors with
> Sirius, so we're giving it a try in our project. Currently we have a
> problem where we need a container with an advanced layout. Our goal
> could be achieved by chaining small containers together with the
> currently available layouts but this will complicate the graphical model
> and there are concerns about maintainability and performance.
>
> One very nice solution would be if we could define our own layout
> manager, which would take care of the positions of the contained child
> nodes. Since we're new to Sirius (and GMF) we couldn't easily find the
> place where we could just plug our custom layout provider. I was hoping
> that someone with more experience might point us to the right direction
> or even better provide us with an example. Thanks!
Re: Custom Layout for Containers[message #1404376 is a reply to message #1404011]Thu, 31 July 2014 17:01
Aleksandar Kanchev
Messages: 4
Registered: July 2014
Hi Florian,
thanks a lot for the quick answer. So far I found a nice documentation about layout providers and view ordering:
h_ttp://docs.obeonetwork.com/obeodesigner/6.2/viewpoint/developer/general/extensions-provide_custom_arrange-all.html
The concept seems quite easy to understand but I'm stuck at arranging the child views of a container. I'm trying to use the GridLayoutProvider for my diagram but it seems that it won't go down the hierarchy and order the views of containers.
For example the DefaultLayoutProvider would check if the current action is 'Arrange All' i.e. it has the Diagram view itself, then it'll check if there's a custom layout provider registered for that diagram and it'll discover the GridLayoutProvider that I registered. Then it'll always call the GridLayoutProvider with the children of the diagram which would be the single root element of the diagram. The logic at that point is always the same: arrange the current elements as grid (so 1x1 grid in this case) and layout the container of those elements (so the diagram itself). In another words:
DefaultLayoutProvider.layoutEditParts(GraphicalEditPart diagramEditPart, IAdaptable layoutHint):
-> GridLayoutProvider.layoutEditParts(diagramEditPart.getChildren(), layoutHint):
->-> childrenGrid = myViewOrdering.getSortedViewsAsGrid(diagramEditPart.getChildren())
->-> buildGridCommand(childrenGrid)
->-> buildContainerCommand(diagramEditPart)
Am I missing something important here?
Regards,
Aleksandar
Re: Custom Layout for Containers[message #1404458 is a reply to message #1404376]Fri, 01 August 2014 13:50
Florian Barbin
Messages: 253
Registered: August 2010
Hi Aleksandar,
The GridLayoutProvider doesn't handle the container hierarchy. The
GridLayoutProvider is actually used as part of the
OrderedTreeLayoutProvider but not as a 'ready to use' layout provider.
You could use it as your main structural layout in the case of your own
layout provider that will deal with the hierarchy.
Regards,
Florian
On 07/31/2014 07:01 PM, Aleksandar Kanchev wrote:
> Hi Florian,
>
> thanks a lot for the quick answer. So far I found a nice documentation
> about layout providers and view ordering:
>
> h_ttp://docs.obeonetwork.com/obeodesigner/6.2/viewpoint/developer/general/extensions-provide_custom_arrange-all.html
>
>
> The concept seems quite easy to understand but I'm stuck at arranging
> the child views of a container. I'm trying to use the GridLayoutProvider
> for my diagram but it seems that it won't go down the hierarchy and
> order the views of containers.
>
> For example the DefaultLayoutProvider would check if the current action
> is 'Arrange All' i.e. it has the Diagram view itself, then it'll check
> if there's a custom layout provider registered for that diagram and
> it'll discover the GridLayoutProvider that I registered. Then it'll
> always call the GridLayoutProvider with the children of the diagram
> which would be the single root element of the diagram. The logic at that
> point is always the same: arrange the current elements as grid (so 1x1
> grid in this case) and layout the container of those elements (so the
> diagram itself). In another words:
>
> DefaultLayoutProvider.layoutEditParts(GraphicalEditPart diagramEditPart,
> IAdaptable layoutHint):
> -> GridLayoutProvider.layoutEditParts(diagramEditPart.getChildren(),
> layoutHint):
> ->-> childrenGrid =
> myViewOrdering.getSortedViewsAsGrid(diagramEditPart.getChildren())
> ->-> buildGridCommand(childrenGrid)
> ->-> buildContainerCommand(diagramEditPart)
>
> Am I missing something important here?
>
> Regards,
> Aleksandar
Re: Custom Layout for Containers[message #1404688 is a reply to message #1404458]Tue, 05 August 2014 06:08
Aleksandar Kanchev
Messages: 4
Registered: July 2014
Hi Florian,
thanks again for your prompt reply! I kind of figured that out after digging through the code and trying to make sense out of it. For someone who's new to GEF, GMF and Sirius this wasn't quite an easy task. I have to say that looking through the implementation of ecoretools 2.0 provided me some clarity about alternative solution.
In our case we must support a diagram with up to 3000 container nodes directly attached to the root diagram node. Within each of them 6 small lists and around 20 editable labels have to be displayed. At first I was thinking about providing inline editing but for this the VSM (.odesign) is getting quite complicated and hence my concern about performance. While looking at ecoretools 2.0 I saw that it's possible to render the string representation of EMF feature via custom service. Editing isn't inline but with the help of wizards which support validation. Such implementation is very lightweight and easy for me to understand. I think I'll go for it.
Nevertheless we'll need to use different layout manager for some Containers/Compartments than the default RegionContainerLayoutManager. I saw that it's possible to provide a different EditPart instance based on a VISUAL_ID. That's how nodes with transparency are implemented within ecoretools 2.0. I tried that approach and provided my own version of DNodeContainerViewNodeContainerCompartment2EditPart to sirius. I tried overriding the getLayoutManager() method and providing GridLayout for the figure but it didn't work. The diagram won't open at all and I'll get a very long stack trace which get's stuck at validation() and isMirrored() methods. Google gave me a hint that it might be something with a XYLayout but it makes no sense to me. Do you know what might be the cause or can you give me a reference to some documentation or examples about using different layouts within containers/compartments?
Cheers
Aleksandar
Previous Topic:Dynamic editor palette customization?
Next Topic:4 minute tutorial - empty diagram?
Goto Forum:

Tutorial Empty Spaces The Blog Template


-=] Back to Top [=-

Empty Spaces Pink Floyd


Current Time: Thu Jan 21 09:53:39 GMT 2021

Empty Spaces Linkin Park


Tutorialempty Spaces The Blog Examples

Powered by FUDForum. Page generated in 0.02125 seconds