POV-Ray : Newsgroups : povray.general : Generate normal map : Re: Generate normal map Server Time
25 Apr 2024 23:31:53 EDT (-0400)
  Re: Generate normal map  
From: Bald Eagle
Date: 1 Oct 2019 19:10:00
Message: <web.5d93dc6d892ac194eec112d0@news.povray.org>
Here's a quick example:


#version 3.8;
global_settings {
 assumed_gamma 1.0
}
#include "colors.inc"
#include "functions.inc"

camera {
 location  <0, 0, -10>
 look_at   <0, 0,  0>
 right     x*image_width/image_height
 up y
}

light_source {<-5, 1, -10> colour rgb 1}

#declare Noise = function {f_noise3d (x, y, z) }

#declare P = pigment {Gray50}

#declare Radius = 2;
#declare NS = 0.2; // NoiseScale
#declare NoiseStrength = 0.15;
isosurface {
 //function {y - Noise (x, 0, z) * 2 }
 function {sqrt(pow (x, 2) + pow (y, 2) + pow (z, 2)) - Radius - (Noise (x/NS,
y/NS, z/NS)*NoiseStrength) }

 max_gradient 2
 accuracy 0.001
 contained_by {box {<-Radius, -Radius, -Radius>*1.1, <Radius, Radius*3,
Radius>*1.1} }
 scale <1, 1.5, 1>
 texture {
  pigment {P}
  finish {diffuse 0.4 specular 0.2}
 }
}

---------------------------------------------------------------------------

Also, maybe if you have a uv-mappable image of an asteroid, you could use a
bump_map normal on a [scaled] sphere.

From the drop-down Insert Menu
Textures and Materials > Textures > Texture Maps > bump_map normal

// texture normal {} attribute
// create a texture that has a bumpiness corresponding to color index
// image maps into X-Y plane from <0,0,0> to <1,1,0>
bump_map { // uses image color or index as bumpiness
  png "plasma3.png" // the file to read (iff/tga/gif/png/jpeg/tiff/sys)
  map_type 1        // 0=planar, 1=spherical, 2=cylindrical, 5=torus
  interpolate 2     // 0=none, 1=linear, 2=bilinear, 4=normalized distance
  // once           // for no repetitive tiling
  // [use_color | use_index]
  bump_size 0.5     // 0...3
} // bump_map


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.