[Bf-cycles] uv coordinates in Cycles standalone

Guillaume Rouault guillaume.rouault.fx at gmail.com
Tue Dec 15 14:08:04 CET 2015


Hey Jasper, thank you for moral support ^^
I haven't given up yet !
I am particularly puzzled by something : in the uv_cube.xml mesh example ,
the result is exactly the same with only 4 uv coords in the UV data  ( i.e
just the first quad) ...  the other faces seem to have automatically the
same coords as the first one. In this example it make no difference,
because all faces of the cube had texture coordinates going the full uv
range 0-1. But, while trying to go back to basic and export the simplest
object,  I managed export a cube with uv coordinates to, but contrary to
the provided mesh example, my cube faces all have different uv coordinates,
and yet the result in cycles was ALL the faces are mapped like the first
quad,even though in the .xml file the uvs correctly written .... what's up
with that ?

I hope I am being clear ...

I will conquer  ... some day ... soon !! ^^

thank you for your help

Guillaume

On Tue, Dec 15, 2015 at 11:37 AM, Jasper Kindt <jasper.kindt at gmail.com>
wrote:

> Guillaume,
>
> Don't give up. I suggest building a pointcloud export and figuring out
> the indexing out of primitive exports first. Perhaps export a single
> quad as that was all I needed for my implementation, but I am sure you
> can find out how the winding works in a triangle list. Wish I could
> help you more...
>
> Cheer up,
> Jasper
>
> On 14/12/2015, Guillaume Rouault <guillaume.rouault.fx at gmail.com> wrote:
> > Hi again,
> >
> >  @Nathan, you mentionned to me somewhere that uvs a listed by triangles,
> > but in the example file you gave me:
> >
> https://github.com/jesterKing/CCSycles/blob/master/tests/objects/uv_cube.xml
> >
> > uvs are clearly listed by squares ( 6 of them of course)
> >
> > To be honest, I have really hard time exporting my uvs from houdini. I've
> > tried a lot of things already, and nothing seems to work, I am on the
> verge
> > of giving up frankly, which would be a shame, because uvs are my last
> main
> > issue, I have almost a basic working solution for simple animations
> > rendering with houdini.
> >
> > Guillaume
> >
> > On Thu, Dec 10, 2015 at 1:14 PM, Guillaume Rouault <
> > guillaume.rouault.fx at gmail.com> wrote:
> >
> >> After reflection, It's dumb of me to think that the error comes from
> >> source code. It definitely comes from my python code :
> >> I was able to render correctly the example object you gave me
> >> 'uv_cube.xml'
> >>
> >> Guillaume
> >>
> >> On Thu, Dec 10, 2015 at 12:45 PM, Guillaume Rouault <
> >> guillaume.rouault.fx at gmail.com> wrote:
> >>
> >>> Thank you guys for your answers, I wanted some infos, and I have plenty
> >>> of them now ^^ .
> >>> I am trying to code a exporter from Houdini to Cycles Standalone. I use
> >>> python to do that in houdini 15.
> >>> The fact is , I am really bad at C++ and after several hours of reading
> >>> the source code, my head hurts a little ^^ .
> >>>
> >>> indeed a lot of infos in cycles_xml.cpp
> >>> I adapted my export script to try and mimic the way mesh is computed.
> >>>
> >>>  in the part of the code you mentionned
> >>>
> https://developer.blender.org/diffusion/C/browse/master/src/app/cycles_xml.cpp;65ff373f0c71c043dd7b5632580501f1fc4bea7e$982
> >>>
> >>> Is it normal that the variable 'index_offset' stays at 0 ?
> >>> Shouldn't it be incremented at every iteration ?
> >>>
> >>> Guillaume
> >>>
> >>> On Thu, Dec 10, 2015 at 6:42 AM, Nathan Letwory <nathan at mcneel.com>
> >>> wrote:
> >>>
> >>>> -----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
> >>>> <
> 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
> >>>> <
> 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-----
> >>>> _______________________________________________
> >>>> Bf-cycles mailing list
> >>>> Bf-cycles at blender.org
> >>>> http://lists.blender.org/mailman/listinfo/bf-cycles
> >>>>
> >>>
> >>>
> >>
> >
> _______________________________________________
> Bf-cycles mailing list
> Bf-cycles at blender.org
> http://lists.blender.org/mailman/listinfo/bf-cycles
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-cycles/attachments/20151215/e12446b6/attachment.htm 


More information about the Bf-cycles mailing list