CgCellShaderD.dpr 1.1 KB

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