Crumbs (Tutorial)

From Serious Sam Wiki
Jump to: navigation, search

Why crumbs?

Crumbs are very good for adding detail to your scenes. They are not expensive to render and are easy to maintain. If you want they will swing on a wind without any performance penalty. They receive correct shadows. If you want, they will follow slope or will colorize acording to the terrain below. You can also add some random colorization.

How crumbs work?

As player moves around and passes from one grid to another, crumbs get recached (unneded ones get removed, ones in your path get cached). You can controll caching and fading of the crumbs. To make huge areas of crumbs that can be visible in far distance, you can use another crumb entity that contains simple group grass that is set to dissapear nearby (they are too primitive to be seen near-by but look good when seen from far).

How to apply crumbs

Insert crumb entity. Select property "Target" and link to ground model (Ctrl+Alt+LMB). Create new crumb config. Browse crumb model for any of the of the channel slots (channels are controlled using RGBA channels of chance/size textures). Create new crumbs layout and new crumb map baker. Bake the crumbs (Shift+B). Reinitialize the entity (Ctrl+Enter).

Hint:  Game crumb models can be found in Content/SeriousSamHD/Models/Plants/ directory.
Hint:  You can have several overlapping crumbs covering some area (e.g. grass, flowers, stones, bushes, trash etc.) You can use one crumb entity to do that or you can use separate crumb entity if you want to use separate setup (this approach uses more memory).
Note:  Crumbs are meant to be used only with the grass shader. Other shaders will display different erroneous behaviors. It is recommended to keep number of polygons in crumb models as low as possible to avoid huge memory consumption and grid recaching slowdowns.
Warning:  Model that is used as crumb must have center pivot points so that shadows would not blink (used for fast, per vertex selection of the correct shadow cascade). Use "Make center pivots" tool to generate it. It will appear under morph map (button "M") called "PositionPivot".
Example brushes:  Here is a set of paint brushes that can be used for painting. Unzip the brushes to Content/ directory. To load a brush, activate paint brush palette, add new brush ("+") and browse it ("...")
Example level:  Given level shows simple terrain with two mixed textures and single shade texture (mask texture and shade textures are painted). Level contains two types of crumbs: grass and flowers. Chance mask is painted so that grass can be found everywhere except below tree. Flowers are added under concrete block with a hole in the middle. Size mask is adjusted so that huge grass grows on the top of the hill. Play with the level and delete/add/size crumbs by painting chance and size masks.File:CrumbsAndTerrainPainting.gro

Screenshots from example level

Crumbs01.jpg Crumbs02.jpg