CgCellShader.dpr 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. {: Simple cell shading with CgShaders.
  2. This demo uses a vertex program to combine the normal and
  3. light vector to produce a light intensity which is passed
  4. to the fragment program as the 3rd element in the texture
  5. coordinate stream. This intensity is then clamped to specific
  6. values based on the range the intensity falls into. This is
  7. how the cells are created. You can add or remove cells by
  8. adding and removing ranges from the intensity clamping in
  9. the fragment program. This intensity is multiplied to the
  10. color value for each fragment retrieved from the texture
  11. map. Using solid colors on the texture gives nice results
  12. once cell shaded.
  13. While this demo only shows parallel lighting, you could use
  14. point lights quite easily by modifying the uniform
  15. parameters passed to the vertex program and the processing
  16. of the intensity. Multiple lights wouldn't be difficult
  17. to implement either.
  18. }
  19. program CgCellShader;
  20. uses
  21. Forms,
  22. fCgCellShader in 'fCgCellShader.pas' {FormCellShading};
  23. {$R *.res}
  24. begin
  25. Application.Initialize;
  26. Application.CreateForm(TFormCellShading, FormCellShading);
  27. Application.Run;
  28. end.