Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
billboard [2020/01/10 12:22] – [Example: Terrain Grass Billboard] admin | billboard [2020/04/11 14:30] – [Billboard] admin | ||
---|---|---|---|
Line 4: | Line 4: | ||
The billboard component is a mesh itself, into which proxies are merged. Much faster rendering is possible if proxy meshes are merge into one mesh, instead of rendering each mesh. | The billboard component is a mesh itself, into which proxies are merged. Much faster rendering is possible if proxy meshes are merge into one mesh, instead of rendering each mesh. | ||
+ | |||
+ | Restriction: | ||
We typically use this technique for grass or trees. | We typically use this technique for grass or trees. | ||
Line 54: | Line 56: | ||
FGrass := TGorillaBillboard.Create(FGorilla); | FGrass := TGorillaBillboard.Create(FGorilla); | ||
FGrass .Parent := FGorilla; | FGrass .Parent := FGorilla; | ||
- | FGrass.SourceObject := LBillboard; | + | FGrass.AddSourceObject(LBillboard); |
FGrass.MaterialSource := LGrassMat; | FGrass.MaterialSource := LGrassMat; | ||
FGrass.SetSize(GORILLA_BILLBOARD_SIZE, | FGrass.SetSize(GORILLA_BILLBOARD_SIZE, | ||
Line 190: | Line 192: | ||
// place billboard chunk over terrain | // place billboard chunk over terrain | ||
LGrass.Position.Point := Point3D(LX, 0, LZ); | LGrass.Position.Point := Point3D(LX, 0, LZ); | ||
+ | | ||
+ | // take the template model material source as material for the billboard | ||
+ | // this could be replaced by a grass material shader of course | ||
LGrass.MaterialSource := FGrassTemps[0].Meshes[0].MaterialSource; | LGrass.MaterialSource := FGrassTemps[0].Meshes[0].MaterialSource; | ||
FGrassBillboards.Add(LGrass); | FGrassBillboards.Add(LGrass); | ||
// fill up billboard chunk with 64 copies of our grass template | // fill up billboard chunk with 64 copies of our grass template | ||
- | LFillAlg := TGorillaBillboardTerrainFilling.Create(LGrass, | + | LFillAlg := TGorillaBillboardTerrainFilling.Create(LGrass, |
try | try | ||
LFillAlg.Count := 64; | LFillAlg.Count := 64; | ||
Line 203: | Line 208: | ||
// we put grass billboard into terrain model | // we put grass billboard into terrain model | ||
- | LGrass.Parent := FTerrain; | + | LGrass.Parent := ATerrain; |
end; | end; | ||
finally | finally |