View Categories

UVWGens

3 dakika okuma

giriiş #


Bu bölümde, dokulandırma ile ilgili önemli bir araç olan UVW koordinat üreteçlerini veya kısaca UVWGens’i ele alacağız. Genel olarak UVW verileri geometride, GeomStaticMesh::map_channels içinde saklanır . Şu formatta bulunur:

# map_channels describe the UVW coordinates used to map a texture to the geometry surface.
geometry.map_channels = [
[
# channel index
1,
# List of UVW coordinates.
# The W coordinate has to be set (0.0 in this case) even when performing 2D texturing.
vray.VectorList(
vray.Vector(0.0, 0.0, 0.0),
vray.Vector(0.0, 1.0, 0.0),
vray.Vector(1.0, 0.0, 0.0),
vray.Vector(1.0, 1.0, 0.0)
),
# List of indices from the UVW list. 
# Each three consecutive indices are used for a single triangle.
# They correspond directly to the vertex indices in the 'faces' array.
vray.IntList(
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2
)
]
]
// The W coordinate has to be set (0.0 in this case) even when performing 2D texturing.
Vector uvwCoords[] = {
Vector(0.0, 0.0, 0.0),
Vector(0.0, 1.0, 0.0),
Vector(1.0, 0.0, 0.0),
Vector(1.0, 1.0, 0.0)
};
// Each three consecutive indices are used for one triangle. 
// They correspond directly to the vertex indices in the 'faces' array.
int uvwIndices[] = {
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2
};
ValueList list;
list.push_back(Value(1));             // channel index
list.push_back(Value(uvwCoords));     // list of UVW coordinates
list.push_back(Value(uvwIndices));    // list of indices from the UVW list
// map_channels describe the UVW coordinates used to map a texture to the geometry surface
ValueList channels;
channels.push_back(Value(list));
geometry.set_map_channels(channels);
List<object> channels = new List<object>();
channels.Add(new List<object> {
// Channel index.
1,
// List of UVW coordinates.
// The W coordinate has to be set (0.0 in this case) even when performing 2D texturing.
new Vector[] {
new Vector(0.0, 0.0, 0.0),
new Vector(0.0, 1.0, 0.0),
new Vector(1.0, 0.0, 0.0),
new Vector(1.0, 1.0, 0.0)
},
// List of indices from the UVW list. 
// Each three consecutive indices are used for one triangle.
// They correspond directly to the vertex indices in the 'faces' array.
new int[] {
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2
}
});
// MapChannels describe the UVW coordinates used to map a texture to the geometry surface.
geometry.MapChannels = channels;
// The W coordinate has to be set (0.0 in this case) even when performing 2D texturing.
var uvwCoords = vray.VectorList(
vray.Vector(0.0, 0.0, 0.0),
vray.Vector(0.0, 1.0, 0.0),
vray.Vector(1.0, 0.0, 0.0),
vray.Vector(1.0, 1.0, 0.0)
);
// Each three consecutive indices are used for one triangle. 
// They correspond directly to the vertex indices in the 'faces' array.
var uvwIndices = vray.IntList(
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2,
2, 0, 1,
1, 3, 2
);
var map_channel = vray.List();
map_channel.push(1);             // channel index
map_channel.push(uvwCoords);     // list of UVW coordinates
map_channel.push(uvwIndices);    // list of indices from the UVW list
// map_channels describe the UVW coordinates used to map a texture to the geometry surface.
var channels = vray.List();
channels.push(map_channel);
geometry.map_channels = channels;

UVWGenKanalı #


Geometri kaynağından gelen UVW verileri için değiştirici. Ana parametre uvw_channel’dır – kullanılacak eşleme kanalı verilerinin indeksi (örneğin  GeomStaticMesh::map_channels ). Varsayılan değer 1’dir, tıpkı indekslemenin 1’den başladığı 3dsMax’te olduğu gibi, ancak uygulamanızda bu 0 veya başka bir değer olabilir. -1 indeksini ayarlarsanız, V-Ray ilk kullanılabilir kanalı alacaktır. Bu eklenti ayrıca dönüştürme, sarma ve kırpma parametrelerinin yanı sıra başka bir UVWGen eklentisinden UVW verisi alma seçeneğine de sahiptir.

Parametreler #

  • uvw_transform  – Aynalama, kırpma vb. işlemlerden önce uvw koordinatlarına uygulanan ilk dönüşüm.

  • uvw_transform_tex – uvw_transform  ile aynıdır  , ancak dönüşümler içeren dokuyu alır.

  • tex_transform  – Aynalama, kırpma vb. işlemlerden sonra elde edilen uvw koordinatlarına uygulanan son dönüşüm.

  • nsamples  – uvw dönüşüm örneklerinin sayısı

  • wrap_u/v/w  – 0 – sarmalama yok, 1 – sarmalama, 2 – ayna döşeme

  • crop_u/v/w  – 1, u/v/w yönünde kırpmak için kullanılır.

  • Kapsam  – Kapsam

  • uvw_coords  – Belirtilen kanal için mevcut gölgelendirme noktasındaki uvw koordinatları.

  • wrap_mode  – Sarma modu (0 – 0,5 sınırında sarma; 1 – tam sayı sınırında sarma)

  • duvw_scale  – Doku türevleri için ek ölçek faktörü

  • uvw_channel  – Yukarıda açıklanmıştır.

  • uvwgen  – İsteğe bağlı UVWGen; yüzey noktası yerine başlangıç ​​uvw koordinatlarının alınacağı kaynak.

  • use_double_sided_mode  – Bu doğruysa, ön yüz için uvw_channel ve arka yüz için uvw_channel + 1 kullanacağız. Bu öncelikle V-Ray for SketchUp içindir.

Örnekler #

TexUVW’nin yardımıyla, UVW jeneratörlerini kullanarak oluşturabileceğimiz farklı UVW alanlarını görselleştirebiliriz. İşte kullandığımız kod:

# Create a new UVWGenChannel
UVWGen = renderer.classes.UVWGenChannel()

# Create a new TexUVW. It allows displaying of UVW space as RGB
uvwTex = renderer.classes.TexUVW()
uvwTex.uvwgen = UVWGen

// Create a new UVWGenChannel
UVWGenChannel UVWGen = renderer.newPlugin<UVWGenChannel>();

// Create a new TexUVW. It allows displaying of UVW space as RGB
TexUVW uvwTex = renderer.newPlugin<TexUVW>();
uvwTex.set_uvwgen(UVWGen);

// Create a new UVWGenChannel
UVWGenChannel UVWGen = renderer.NewPlugin<UVWGenChannel>();

// Create a new TexUVW. It allows displaying of UVW space as RGB
TexUVW uvwTex = renderer.NewPlugin<TexUVW>();
uvwTex.Uvwgen = UVWGen;

// Create a new UVWGenChannel
var UVWGen = renderer.classes.UVWGenChannel();

// Create a new TexUVW. It allows displaying of UVW space as RGB
var uvwTex = renderer.classes.TexUVW();
uvwTex.uvwgen = UVWGen;

UVWGenÇevre #


Ortam renk yuvasına veya kubbe ışıklarına küresel, küp vb. dokuları eşlemek için kullanılır.

Parametreler #

  • uvw_matrix  – Giriş yönlerinin dönüşümü

  • uvw_transform  – Elde edilen UVW koordinatlarının dönüştürülmesi

  • mapping_type  – “angular”, “cubic”, “spherical”, “mirror_ball”, “screen”, “max_spherical”, “spherical_vray”, “max_cylindrical” veya “max_shrink_wrap” seçeneklerinden biri.

  • wrap_u/v/w  – 0 – sarmalama yok, 1 – sarmalama, 2 – ayna döşeme

  • crop_u/v/w  – 1, u/v/w yönünde kırpmak için kullanılır.

  • duvw_scale  – Doku türevleri için ek ölçek faktörü

  • zeminde  –

  • zemin_konumu  – Zemin düzleminin normal vektörü

  • yer_yarıçapı  – Yer çemberinin yarıçapı

Örnek #

Bu örnekte, UVWGen’in küresel haritalaması kullanılarak dokulu bir kubbe ışığı oluşturacağız :

# The UVWGenEnvironment allows spherical, cube, etc. textures to be mapped on the environment color slot or dome lights.
uvwgen = renderer.classes.UVWGenEnvironment()
# Specify the type and shape of the texture.
uvwgen.mapping_type = 'spherical'
# Specify transformation of the input directions.
uvwgen.uvw_matrix = vray.Matrix( vray.Vector(1, 0, 0), vray.Vector(0, 0, 1), vray.Vector(0, -1, 0))
uvwgen.ground_on = 1
 
bitmap = renderer.classes.BitmapBuffer()
# unlike JPG files, HDR files are linear
bitmap.transfer_function = 0
bitmap.file = os.path.join(SCENE_PATH, 'assets', 'Sea_D.hdr')
 
texture = renderer.classes.TexBitmap()
# Specify UVW generator for the texture.
texture.uvwgen = uvwgen
# Specify the bitmap that the texture will be using.
texture.bitmap = bitmap
 
light = renderer.classes.LightDome()
# Switches between a hemispherical or (full) spherical shape of the light.
# Possible values are: True (Sphere), False (Hemisphere)
light.dome_spherical = True
# Specify the light texture.
light.dome_tex = texture
# Enable the use of a light texture.
# If "use_dome_tex = False" the 'color' of the light will be used instead.
light.use_dome_tex = True
// The UVWGenEnvironment allows spherical, cube, etc. textures to be mapped on the environment color slot or dome lights.
UVWGenEnvironment uvwgen = renderer.newPlugin<UVWGenEnvironment>();
// Specify the type and shape of the texture.
uvwgen.set_mapping_type("spherical");
// Specify transformation of the input directions.
uvwgen.set_uvw_matrix( Matrix( Vector(1.0, 0.0, 0.0), Vector(0.0, 0.0, 1.0), Vector(0.0, -1.0, 0.0)));
uvwgen.set_ground_on(1);
 
BitmapBuffer bitmap = renderer.newPlugin<BitmapBuffer>();
// unlike JPG files, HDR files are linear
bitmap.set_transfer_function(0);
bitmap.set_file("assets" PATH_DELIMITER "Sea_D.hdr");
 
TexBitmap texture = renderer.newPlugin<TexBitmap>();
// Specify UVW generator for the texture.
texture.set_uvwgen(uvwgen);
// Specify the bitmap that the texture will be using.
texture.set_bitmap(bitmap);
 
LightDome light = renderer.newPlugin<LightDome>();
// Switches between a hemispherical or (full) spherical shape of the light.
// Possible values are: true (Sphere), false (Hemisphere) - default
light.set_dome_spherical(true);
// Specify the light texture.
light.set_dome_tex(texture);
// Enable the use of a light texture.
// If "use_dome_tex = false" the 'color' of the light will be used instead.
light.set_use_dome_tex(true);
// The UVWGenEnvironment allows spherical, cube, etc. textures to be mapped on the environment color slot or dome lights.
UVWGenEnvironment uvwgen = renderer.NewPlugin<UVWGenEnvironment>();
// Specify the type and shape of the texture.
uvwgen.MappingType = "spherical";
// Specify transformation of the input directions.
uvwgen.UvwMatrix = new Matrix( new Vector(1, 0, 0), new Vector(0, 0, 1), new Vector(0, -1, 0));
uvwgen.GroundOn = 1;
 
BitmapBuffer bitmap = renderer.NewPlugin<BitmapBuffer>();
// unlike JPG files, HDR files are linear
bitmap.TransferFunction = 0;
bitmap.File = Path.Combine("assets", "Sea_D.hdr");
 
TexBitmap texture = renderer.NewPlugin<TexBitmap>();
// Specify UVW generator for the texture.
texture.Uvwgen = uvwgen;
// Specify the bitmap that the texture will be using.
texture.Bitmap = bitmap;
 
LightDome light = renderer.NewPlugin<LightDome>();
// Switches between a hemispherical or (full) spherical shape of the light.
// Possible values are: true (Sphere), false (Hemisphere)
light.DomeSpherical = true;
// Specify the light texture.
light.DomeTex = texture;
// Enable the use of a light texture.
// If "use_dome_tex = False" the 'color' of the light will be used instead.
light.UseDomeTex = true;
// The UVWGenEnvironment allows spherical, cube, etc. textures to be mapped on the environment color slot or dome lights.
var uvwgen = renderer.classes.UVWGenEnvironment();
// Specify transformation of the input directions.
uvwgen.uvw_matrix = vray.Matrix( vray.Vector(1, 0, 0), vray.Vector(0, 0, 1), vray.Vector(0, -1, 0));
// Specify the type and shape of the texture.
uvwgen.mapping_type = "spherical";
uvwgen.ground_on = 1;
 
var bitmap = renderer.classes.BitmapBuffer();
// unlike JPG files, HDR files are linear
bitmap.transfer_function = 0;
bitmap.file = path.join(SCENE_PATH, "assets", "Sea_D.hdr");
 
var texture = renderer.classes.TexBitmap();
// Specify UVW generator for the texture.
texture.uvwgen = uvwgen;
// Specify the bitmap that the texture will be using.
texture.bitmap = bitmap;
 
var light = renderer.classes.LightDome();
// Switches between a hemispherical or (full) spherical shape of the light.
// Possible values are: true (Sphere), false (Hemisphere)
light.dome_spherical = true;
// Specify the light texture.
light.dome_tex = texture;
// Enable the use of a light texture.
// If "use_dome_tex = false" the 'color' of the light will be used instead.
light.use_dome_tex = true;

UVWGenExplicit #


Doku verilerinden açık UVW verileri tanımlayın.

Parametreler #

  •  – kayan noktalı sayıların U girişi

  •  – float’ların V girişi

  •  – float’ların W girişi

  • uvw  – UVW dokusu olarak girilir

UVWGenMayaPlace2dTexture #


UVWGenChannel’a benzer, ancak daha fazla seçeneğe sahip.

Parametreler #

  • uvw_channel_tex  – Bu 2 boyutlu yerleşim için birden fazla mesh’in UV bağlantısı belirtildiğinde kullanılır. Mevcutsa, uvw_channel’ı geçersiz kılar.

  • uvwgen  – İsteğe bağlı UVWGen; yüzey noktası yerine başlangıç ​​uvw koordinatlarının alınacağı kaynak.

  • nsamples  – Hareket bulanıklığı için alınacak parametre örneklerinin sayısı. 0 genel değeri ifade eder. 1 ise bu eklenti için hareket bulanıklığının devre dışı bırakılması gerektiği anlamına gelir.

  • uv_set_name  – Kullanılacak UV kanalının adı.

UVWGenObject #


Bu jeneratör, dünya uzayındaki koordinatları nesne uzayına dönüştürür.

Parametreler #

  • uvw_transform  – uvw koordinatlarında ilk dönüşüm

  • duvw_scale  – Doku türevleri için ek ölçek faktörü


UVWGenPlanarWorld #


Bu jeneratör UVW koordinatlarını dünya uzayında döndürür.

Parametreler #

  • uvw_transform  – Aynalama, kırpma vb. işlemlerden önce uvw koordinatlarına uygulanan ilk dönüşüm.

  • uvw_transform_tex  – Doku Dönüşümü

  • tex_transform  – Aynalama, kırpma vb. işlemlerden sonra elde edilen uvw koordinatlarına uygulanan son dönüşüm.

  • nsamples  – uvw dönüşüm örneklerinin sayısı

  • wrap_u/v/w  – 0 – sarmalama yok, 1 – sarmalama, 2 – ayna döşeme

  • crop_u/v/w  – 1, u/v/w yönünde kırpmak için kullanılır.

  • Kapsam  – Kapsam

  • uvw_coords  – Belirtilen kanal için mevcut gölgelendirme noktasındaki uvw koordinatları.

  • wrap_mode  – Sarma modu (0 – 0,5 sınırında sarma; 1 – tam sayı sınırında sarma)

  • duvw_scale  – Doku türevleri için ek ölçek faktörü

Tarafından desteklenmektedir BetterDocs

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir