[Bf-cycles] uv coordinates in Cycles standalone

Nathan Letwory nathan at mcneel.com
Thu Dec 10 06:42:36 CET 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I haven't actually tested this in the C++ standalone version, but only
in my C# CCSycles tester, but check out

https://github.com/jesterKing/CCSycles/blob/master/tests/objects/uv_cube
.xml

You'll have to add a texture coordinate input node and connect it to
the image texture node (vector). That should have your shader use UV
coordinates from the mesh data.

UV coordinates are per triangle (you can double-check here:
https://developer.blender.org/diffusion/C/browse/master/src/app/cycles_x
ml.cpp;65ff373f0c71c043dd7b5632580501f1fc4bea7e$982)

Here a custom RhinoCycles material using XML with a texture coordinate
input node:
https://github.com/mcneel/RhinoCycles/blob/master/Materials/BrickWithChe
ckeredMortar.cs

And here for the C#-way of creating nodes in RhinoCycles where I set
projection and mappings
https://github.com/mcneel/RhinoCycles/blob/master/RenderEngine.Utils.cs#
L131
- - in this function the last else block is probably the most
interesting, since here I connect the UV output from texture
coordinate input node :)

Hope that helps,

/Nathan

On 09/12/2015 23:42, Guillaume Rouault wrote:
> 
> I couldn't find a file named blender_mesh.cpp in the sources I
> have. And I think it would mainly give me some infos on how to
> format the mesh in the xml object file. but my main issue, I think,
> is at the shader level in the scene xml file, using the standalone
> XML API . How do I force the shader to use uv coordinates provided
> on the mesh ?
> 
> Now that I think of it, there are no examples using uv mapped
> objects in the /examples folder, at least nothing using coordinates
> generated during modeling.  Is it even supported at this stage in
> the standalone version ?
> 
> Guillaume
> 
> On Wed, Dec 9, 2015 at 10:19 PM, Mohamed Sakr <3dsakr at gmail.com 
> <mailto:3dsakr at gmail.com>> wrote:
> 
> in blender_mesh.cpp, find attr_create_uv_map() function and see
> how they create UVs
> 
> On Wed, Dec 9, 2015 at 10:26 PM, Guillaume Rouault 
> <guillaume.rouault.fx at gmail.com 
> <mailto:guillaume.rouault.fx at gmail.com>> wrote:
> 
> Hi,
> 
> I can't find any infos on uv coordinates for cycles standalone. As
> of now, I haven't been able to render an object with the correct
> uvs. I can see a texture, but it's mapped to every triangle on the
> mesh.
> 
> I searched the xml api , and came up with that setup :
> 
> 
> *<!-- floor shader-->* *<shader name="floor" >* *<diffuse_bsdf
> name="diffuse" roughness="0.05" color="1.0, 1.0, 1.0" />* 
> *<glossy_bsdf name="glossy" roughness="0.05" color="0.2, 0.2, 0.2"
> />* * * *<texture_coordinate name="uv" />* *<image_texture
> name="tex" src="./maps/aaa.jpg" />* *<add_closure name="mix" />* 
> *<fresnel name="fresnel" />* *<connect from="fresnel fac"
> to="glossy color" />* * * *<connect from="uv uv" to="tex vector"
> />* *<connect from="tex color" to="diffuse color" />* * * * * 
> *<connect from="diffuse bsdf" to="mix closure1" />* *<connect
> from="glossy bsdf" to="mix closure2" />* *<connect from="mix
> closure" to="output surface" />* *</shader>* * * * * Am I on the
> right path ? * * Are there any examples or infos on uvs somewhere
> ? Actually, on my meshes,  I don't even know if I have to export uv
> coords as vector2  (uv) , or vector3 (uvw) ? * * * * *Guillaume*


- -- 
Nathan Letwory
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWaRDMAAoJEKtfN7KsE0TtOXsH/2soTeJzRwChnzexs2SqgnJc
QWFo750pglTVpmmH2SDLGKg6fVofCYPzhc5UWnbR1+mlCkC+E8VsBLLu6CaG5Whb
6Tfwq7uOE9Rht1dlE2PxzhzaoV/Q++cOIgubaCfq3sofBXIE5qbjYSLwtyrKDj7c
lhrPx/FwaapEHzEArjfWENbESVEHb7kJh9d39E3qeeCarflBDgJKVNxVC/SoVnsM
GZIrUWeujIhLpcWt6XN0P68jwQdyUnX6Kx8k7aN3iG6Un7BfxaqlY+/+W5sUKQhG
w7c349NeHj+gTJzbYTdY3f9zMLrVc2Iz7eVCmVy048aK2nMvG6+PunXcLBh6KVQ=
=/YDa
-----END PGP SIGNATURE-----


More information about the Bf-cycles mailing list