ProjectScale and RayObject [SOLVED]



  • On 04/06/2015 at 10:18, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   15+ 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    why ProjectScale doesn't affect RayObject transforms/point coordinates, etc...

    so a ProjectScale of 1cm will generate the same RayObject of a ProjectScale with 1m, but if you access the data directly of the op through the link, the data will be different.

    any automatic solution? or I have to multiply the ProjectScale manually by all accessed data?



  • On 05/06/2015 at 07:51, xxxxxxxx wrote:

    Hi Mohamend,
    we will probably need some time to get to this issue. But it won't be forgotten.



  • On 09/06/2015 at 09:04, xxxxxxxx wrote:

    Hello,

    can you explain how exactly you access the RayObject and what data you are accessing "directly of the op through the link" ? If possible, please provide some code.

    Best wishes,
    Sebastian



  • On 09/06/2015 at 10:08, xxxxxxxx wrote:

    right now I access them directly through op->padr and op->vadr, and there is a case where I need to access through link, so consider accessing by both ways.



  • On 10/06/2015 at 02:58, xxxxxxxx wrote:

    Hello,

    I could not reproduce any problems accessing the point data from the RayObject and from the linked PolygonObject. Please provide some code showing what you do and what the problem is.

    Best wishes,
    Sebastian



  • On 10/06/2015 at 03:52, xxxxxxxx wrote:

      
    				const Vector *points = op->padr;
    				const RayPolygon *polys = op->vadr;  
      
    				vector<float> AllPoints(0);
    				vector<float> AllPointsUV(0);
    				vector<float> AllPointsNormal(0);
    				AllPoints.reserve(op->vcnt * 3);
    				AllPointsUV.reserve(op->vcnt * 3);
    				AllPointsNormal.reserve(op->vcnt * 3);  
      
    				for(Int32 j = 0; j < op->vcnt; ++j)
    				{
    					int npIndices = (polys[j].c != polys[j].d)? 12 : 9;
    										
    					AllPoints.push_back(points[polys[j].a].x);
    					AllPoints.push_back(points[polys[j].a].y);
    					AllPoints.push_back(points[polys[j].a].z);
    					AllPoints.push_back(points[polys[j].b].x);
    					AllPoints.push_back(points[polys[j].b].y);
    					AllPoints.push_back(points[polys[j].b].z);
    					AllPoints.push_back(points[polys[j].c].x);
    					AllPoints.push_back(points[polys[j].c].y);
    					AllPoints.push_back(points[polys[j].c].z);
      
    					PolyVector mUVW;
    					vps->vd->GetUVW(op, 1, j, &mUVW);
    					AllPointsUV.push_back(mUVW.a.x);
    					AllPointsUV.push_back(mUVW.a.y);
    					AllPointsUV.push_back(0.f);
    					AllPointsUV.push_back(mUVW.b.x);
    					AllPointsUV.push_back(mUVW.b.y);
    					AllPointsUV.push_back(0.f);
    					AllPointsUV.push_back(mUVW.c.x);
    					AllPointsUV.push_back(mUVW.c.y);
    					AllPointsUV.push_back(0.f);
      
    					PolyVector mNormal;
    					vps->vd->GetNormals(op, j, &mNormal);
    					AllPointsNormal.push_back(mNormal.a.x);
    					AllPointsNormal.push_back(mNormal.a.y);
    					AllPointsNormal.push_back(mNormal.a.z);
    					AllPointsNormal.push_back(mNormal.b.x);
    					AllPointsNormal.push_back(mNormal.b.y);
    					AllPointsNormal.push_back(mNormal.b.z);
    					AllPointsNormal.push_back(mNormal.c.x);
    					AllPointsNormal.push_back(mNormal.c.y);
    					AllPointsNormal.push_back(mNormal.c.z);
      
    					if(npIndices == 12)
    					{
    						AllPoints.push_back(points[polys[j].a].x);
    						AllPoints.push_back(points[polys[j].a].y);
    						AllPoints.push_back(points[polys[j].a].z);
    						AllPoints.push_back(points[polys[j].c].x);
    						AllPoints.push_back(points[polys[j].c].y);
    						AllPoints.push_back(points[polys[j].c].z);
    						AllPoints.push_back(points[polys[j].d].x);
    						AllPoints.push_back(points[polys[j].d].y);
    						AllPoints.push_back(points[polys[j].d].z);
      
    						AllPointsUV.push_back(mUVW.a.x);
    						AllPointsUV.push_back(mUVW.a.y);
    						AllPointsUV.push_back(0.f);
    						AllPointsUV.push_back(mUVW.c.x);
    						AllPointsUV.push_back(mUVW.c.y);
    						AllPointsUV.push_back(0.f);
    						AllPointsUV.push_back(mUVW.d.x);
    						AllPointsUV.push_back(mUVW.d.y);
    						AllPointsUV.push_back(0.f);
      
    						AllPointsNormal.push_back(mNormal.a.x);
    						AllPointsNormal.push_back(mNormal.a.y);
    						AllPointsNormal.push_back(mNormal.a.z);
    						AllPointsNormal.push_back(mNormal.c.x);
    						AllPointsNormal.push_back(mNormal.c.y);
    						AllPointsNormal.push_back(mNormal.c.z);
    						AllPointsNormal.push_back(mNormal.d.x);
    						AllPointsNormal.push_back(mNormal.d.y);
    						AllPointsNormal.push_back(mNormal.d.z);
    					}
    				}
    

    the problem: the point coordinate data is the same when project size is changing, so if you render 2 times, 1 with project size of (cm) and another with (m), accessing data from here will be the same, while if you access through (op->link) it will be different.



  • On 10/06/2015 at 10:17, xxxxxxxx wrote:

    Hello,

    could you please share some code showing how to "access through (op- >link)" and how you detect the difference?

    Best wishes,
    Sebastian



  • On 14/06/2015 at 22:13, xxxxxxxx wrote:

    ok Sebastian, I figured out where the problem is, I thought the value that I get from description = the value shown inside Cinema4D, but with DESC_UNIT_METER it is "faked"

    so how to get the value shown inside Cinema4D (so if it is set to meter, it will show 20000 cm, but it prints 200)?



  • On 15/06/2015 at 02:07, xxxxxxxx wrote:

    Hello,

    I don't really understand what you are saying. What do you "get from description", what is "shown inside Cinema4D" ?

    Please explain what you are doing and how are you doing it.

    Best wishes,
    Sebastian



  • On 15/06/2015 at 05:28, xxxxxxxx wrote:

    ok, here is a reproduce of the problem:

      
    RayLight *lt = vps->vd->GetLight(i);  
    BaseObject* bop = lt->link;  
      
    GeData idata;  
    bop->GetParameter(DescLevel(LIGHT_AREADETAILS_SIZEX), idata, DESCFLAGS_GET_0);   
    Float32 sizex = idata->GetFloat();//sizex now = 200  
    /*inside Cinema4D, go to the light -> Details tab -> Size X ->   
    it will show 200 cm (if project scale is CM) //matches sizex  
    it will show 20000 cm (if project scale is Meter)*/  
    

    what I want: sizex = 20000cm when project scale is in Meter, in short "get the project scale multiplier factor".



  • On 16/06/2015 at 03:18, xxxxxxxx wrote:

    Hello,

    you can get the scene's current scale accessing the unitscale property of the RayParameter structure that is available with GetRayParameter().

    Best wishes,
    Sebastian



  • On 16/06/2015 at 04:40, xxxxxxxx wrote:

    thanks Sebastian, you can consider this as solved


Log in to reply