![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: m steiger
Subject: How to synchronize texture heightfield with texture colors
Date: 8 Jan 2011 05:46:53
Message: <4d28409d@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
I was trying to synchronize a heightfield defined by a crackle texture
with a color texture that also uses a crackle pattern.
Because of using a color texture with normal shading this should give a
great 3d impression.
But the scaling seems to be wrong.
Picture 1 shows the naked heightfield.
Picture 2 a colored heightfield example.
But as you can see the heights are colored wrong.
Any idea how to syncronize this 2 textures ?
//*********************************************************
// Persistence of Vision Ray Tracer Scene Description File
// File: Heightfield_sync_1.pov
// Desc: Basic heightfield synronize example
// Date: 2010-01-08
// Auth: Martin Steiger
// Time: 00:00:17 1680*1050
//*********************************************************
#version 3.6;
#include "colors.inc"
//--- camera ---
camera { location <5, 2.8, -2>
look_at <5, 1.5, 0> }
//--- lights ---
light_source {<-140,200,300> rgb 1.5}
light_source {<140,200,-300> rgb 0.5}
//--- color texture ---
#declare texture1 =
texture {
normal {crackle 16}
pigment {crackle
color_map { [ 0 color Gray*0.8]
[ 1 color Red*0.8] }
//scale 0.1
}
finish {ambient 0.4 diffuse 0.6 phong 1}
}
//--- heightfield ---
height_field // bitmap <0,0,0> .. <1,1,0>
{ function 1024,1024 // resolution
{
pigment // heightfield texture
{ crackle
color_map { [ 0 color 0]
[ 1 color 1] }
scale 0.1 // pattern scale
}
}
scale <10, 0.3, 10> // size x*h*y
pigment { rgb <222/255, 180/255, 100/255> } // default hf color
texture { texture1 scale 1 translate 0} // colorize texture
}
Post a reply to this message
Attachments:
Download 'heightfield_sync_1.png' (216 KB)
Download 'heightfield_sync_2.png' (347 KB)
Preview of image 'heightfield_sync_1.png'
![heightfield_sync_1.png](/povray.binaries.scene-files/attachment/%3C4d28409d%40news.povray.org%3E/heightfield_sync_1.png?ttop=441393&toff=200&preview=1)
Preview of image 'heightfield_sync_2.png'
![heightfield_sync_2.png](/povray.binaries.scene-files/attachment/%3C4d28409d%40news.povray.org%3E/heightfield_sync_2.png?ttop=441393&toff=200&preview=1)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Christian Froeschlin
Subject: Re: How to synchronize texture heightfield with texture colors
Date: 8 Jan 2011 06:34:03
Message: <4d284bab@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
m.steiger wrote:
> I was trying to synchronize a heightfield defined by a crackle texture
> with a color texture that also uses a crackle pattern.
>
> Because of using a color texture with normal shading this should give a
> great 3d impression.
I'm not sure it makes sense to use normal shading on
a height_field with identical patterns. Basically you
you already have the 3d geometry the normals are
intended to fake.
> But the scaling seems to be wrong.
> Picture 1 shows the naked heightfield.
> Picture 2 a colored heightfield example.
> But as you can see the heights are colored wrong.
>
> Any idea how to syncronize this 2 textures ?
Things which come to mind
1. height_field coordinates may be reversed from what you'd
normally expect, so you might need to rotate it (at leasts
when using image files, not sure about function). You can
figure this out you replace crackle with some regular
asymmetric pattern (e.g. gradient x or z) to see if the
slope is as you expect.
2. when coloring the height_field, crackle pattern is
sampled with y > 0 depending on height, while only
the x-z plane is used when defining the hf itself.
Try scaling the texture up by <1,10000,1> or so
to reduce this effect.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
I think this is because the pattern in the height_field is sampled in x/y
direction while the pattern for the texture is sampled in x/z direction.
Regardless, why don't you use the gradient y pattern? Should do exactly what you
want.
Also, you don't need the normal statement, the height_field has correct normal
vectors already.
Regards Roman
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Gentlemen,
Recent I tryed to apply crackle pattern to both height map and texture and got
some ideas.
1. coordination of height map (0,0) corresponds UV coordination (0,1).
2. XZ plane of height_field object corresponds UV plane as Mr. Froeschlin and
Mr. Reiner wrote.
To synchronize height and texture, I wrote like this:
height_field {
function 800,800 {
// height map(0,0) = UV(0,1)
f_crackle(u,(1-v),0)
}
pigment {
function {
// XZ plane = UV plane
f_crackle(x,z,0)
}
color_map {
(snip)
}
}
}
I hope this mail could be your help.
I wrote an example but it was in japanese.
http://blog.goo.ne.jp/crowbait/e/c17231470a8e840f92f8651a1f02c0b8
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |