1 / 79

Wood Material Generator

This script generates wood textures with customizable colors, rings density, noise frequency, amplitude, and axis orientation. Created by Pierre Saunier, version 1.0.

denzel
Télécharger la présentation

Wood Material Generator

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. vardef ppmParamDef params[6];

  2. funcdef ppmScriptType ppmGetScriptType(void)

  3. {

  4. ppmScriptIdentifier = "Wood Material";

  5. ppmScriptAuthor = "Pierre Saunier";

  6. ppmScriptVersion = 1.0;

  7. return ppmMaterialScript;

  8. }

  9. funcdef void ppmInit(void)

  10. {

  11. vardef ppmPalette palette;

  12. palette = ppmPaletteNew(intToRgbColor(0xC79600), intToRgbColor(0x794200));

  13. palette.addColor(intToRgbColor(0xC79600), 200);

  14. params[0].type = ppmParamPaletteType;

  15. params[0].name = "Colors:";

  16. params[0].paletteObject = palette;

  17. params[1].type = ppmParamFloatType;

  18. params[1].name = "Rings density:";

  19. params[1].floatValue = 1.0;

  20. params[2].type = ppmParamFloatType;

  21. params[2].name = "Noise frequency:";

  22. params[2].floatValue = 1.0;

  23. params[3].type = ppmParamFloatType;

  24. params[3].name = "Noise amplitude:";

  25. params[3].floatValue = 50.0;

  26. params[4].type = ppmParamVectorType;

  27. params[4].name = "center:";

  28. params[4].vectorObject = vector3dNew();

  29. params[5].type = ppmParamChoiceType;

  30. params[5].name = "Axis:";

  31. params[5].selectOptions = "X axis\nY axis\nZ axis";

  32. params[5].selectedValue = 2;

  33. }

  34. funcdef void ppmGenerateTexture(point3d pos, vector3d normal)

  35. {

  36. vardef ppmPalette palette;

  37. vardef float ringFrequency, frequency, perturbation, len;

  38. vardef vector3d center, p;

  39. vardef int axis;

  40. palette = params[0].paletteObject;

  41. ringFrequency = params[1].floatValue;

  42. frequency = params[2].floatValue;

  43. perturbation = params[3].floatValue;

  44. center = params[4].vectorObject;

  45. axis = params[5].selectedValue;

  46. p = vector3dNew();

  47. switch(axis)

  48. {

  49. case 0 :

  50. p.x = 0;

More Related