yaoyansi/maya2renderer — Issue #14: displace shader test case leads a crash in Maya
Author: yaoyansi
Created: 2012-02-24 16:40:27+00:00
State: open

Commit:8a6241128bc4d7a8d86c2b7a4dde46c879f2df39
* liq| er|: +Group::addCameraInstance(), and add camera before mesh in ei_instgroup()

/2.3.3/test/test_shader_pl/test_displace_pl.ma test case can't pass.
Test environment is WinXP x32, Maya2009, er r1117

It camplains "first chance exception".

But I render the exported er API script script.er, it is OK, Here is the script.
-------------------------------------------------------------------------------------------
// Generated by Liquid v2.3.5 (buildtime=23:39:17.81)
// Scene : E:/MyDocuments/maya/projects/default/test_displace_pl
// User : yaoyansi
// Time : Fri Feb 24 23:55:35 2012

//### SCENE BEGIN ###
eiContext *CONTEXT = ei_create_context();
ei_context(CONTEXT);
//ei_set_connection( &(MayaConnection::getInstance()->connection.base );
ei_verbose( 6 );
ei_link( "eiIMG" );
ei_link( "eiSHADER" );
ei_link( "eiSHADER_maya" );
//----------------phong_shader_for_test begin---
ei_shader("phong_shader_for_test");
ei_shader_param_string("desc","plastic");
ei_shader_param_vector("Cs",1,0.2,0.3);
ei_shader_param_vector("Kd",0.7,1,1);
ei_shader_param_scalar("Ks",1);
ei_shader_param_scalar("roughness",0.2);
ei_end_shader();
ei_shader("opaque_shadow_for_test");
ei_shader_param_string("desc","opaque");
ei_end_shader();
ei_material("phong_mtl_for_test");
ei_add_surface("phong_shader_for_test");
ei_add_shadow("opaque_shadow_for_test");
ei_end_material();
//----------------phong_shader_for_test end ---

//############################### option #
ei_options("perspShape_option");
ei_contrast(0.05,0.05,0.05,0.05);
ei_samples(0,2);
ei_filter(4,3);
//transform motion=0, deform motion=0
ei_motion(0);
ei_trace_depth(4,4,4);
ei_displace(1);
ei_max_displace(1);
ei_face(3);
//--------------add manully
eiApprox	approx;
ei_approx_set_defaults(&approx);
approx.method = EI_APPROX_METHOD_LENGTH;
approx.view_dep = eiTRUE;
approx.args[ EI_APPROX_LENGTH ] = 2.0f;
approx.motion_factor = 16.0f;
ei_approx(&approx);
ei_end_options();
// maya settings: focal=35, aperture = 36, aspect=1.33333

//############################### camera #
ei_camera("|persp|perspShape_object");
ei_output("E:/MyDocuments/maya/projects/default/rmanpix/test_displace_pl_perspShape_1.bmp","bmp",1);
ei_output_variable("color",10);
ei_end_output();
ei_focal(35);
ei_aperture(36);
ei_aspect(1.33333);
ei_resolution(768,576);
ei_clip(0.1,1000);
ei_end_camera();
//----------------------------------
ei_instance("|persp|perspShape");
ei_element("|persp|perspShape_object");
ei_transform(0.999848,0,0.0174524,0, 0.00531724,0.952458,-0.304624,0, -0.0166227,0.304671,0.952313,0, -1.76603,8.16087,22.6408,1);
ei_end_instance();
//
// shader(plastic,, ...)
ei_shader("liquidSurface25");
ei_shader_param_string( "desc","plastic");
ei_shader_param_vector("Cs",1,1,1);
ei_shader_param_vector("Kd",1,1,1);
ei_shader_param_scalar("Ks",0.5);
ei_shader_param_scalar("roughness",0.1);
ei_shader_param_vector("specularcolor",1,1,1);
ei_end_shader();
// shader(simple_displace,, ...)
ei_shader("liquidDisplacement1");
ei_shader_param_string( "desc","simple_displace");
ei_shader_param_scalar("disp_dist",1);
ei_end_shader();
// shader(opaque,, ...)
ei_shader("liquidSurface26");
ei_shader_param_string( "desc","opaque");
ei_end_shader();

//------------------------------------ add from liquidSurface24SG.erapi
ei_material("liquidSurface24SG");
ei_add_surface("liquidSurface25");
ei_add_shadow("liquidSurface26");
ei_add_displace("liquidDisplacement1");
ei_end_material();

// Renderer::exportLight("_pointLight1_pointLightShape1");

// Renderer::exportPointLight()
ei_shader("|pointLight1|pointLightShape1_shader");
ei_shader_param_string("desc","pointlight");
ei_shader_param_vector("lightcolor",1,1,1);
ei_shader_param_scalar("intensity",1);
ei_end_shader();
ei_light("|pointLight1|pointLightShape1_object");
ei_add_light("|pointLight1|pointLightShape1_shader" );
ei_origin(0,5.23026,0);
ei_end_light();
ei_instance("|pointLight1|pointLightShape1");
ei_element("|pointLight1|pointLightShape1_object");
ei_end_instance();

// Renderer::exportLight("_pointLight2_pointLightShape2");

// Renderer::exportPointLight()
ei_shader("|pointLight2|pointLightShape2_shader");
ei_shader_param_string("desc","pointlight");
ei_shader_param_vector("lightcolor",1,1,1);
ei_shader_param_scalar("intensity",1);
ei_end_shader();
ei_light("|pointLight2|pointLightShape2_object");
ei_add_light("|pointLight2|pointLightShape2_shader" );
ei_origin(-5.18346,1.22941,0);
ei_end_light();
ei_instance("|pointLight2|pointLightShape2");
ei_element("|pointLight2|pointLightShape2_object");
ei_end_instance();

// Renderer::exportOneGeometry_Mesh(|pPlane2|pPlaneShape11,0,0)

//############################### mesh #
ei_object("pPlaneShape11_object","poly");
{
eiTag tag;
//### vertex positions, fnMesh.numVertices()=4
tag = ei_tab(EI_DATA_TYPE_VECTOR, 1024);
//tag=222
ei_pos_list(222);
ei_tab_add_vector(-0.5,-1.11022e-016,0.5);
ei_tab_add_vector(0.5,-1.11022e-016,0.5);
ei_tab_add_vector(-0.5,1.11022e-016,-0.5);
ei_tab_add_vector(0.5,1.11022e-016,-0.5);
ei_end_tab();
//### N
tag = eiNULL_TAG;
ei_declare("N",2,5, &tag);
tag = ei_tab(EI_DATA_TYPE_VECTOR, 1024);
//tag=224
ei_variable("N", &tag);
ei_tab_add_vector(0,1,2.22045e-016);
ei_tab_add_vector(0,1,2.22045e-016);
ei_tab_add_vector(0,1,2.22045e-016);
ei_tab_add_vector(0,1,2.22045e-016);
ei_end_tab();
//### UV, size=4
tag = eiNULL_TAG;
ei_declare("u",2,5, &tag);
tag = ei_tab(EI_DATA_TYPE_SCALAR, 1024);
//tag=226
ei_variable("u", &tag);
ei_tab_add_scalar(0);
ei_tab_add_scalar(1);
ei_tab_add_scalar(0);
ei_tab_add_scalar(1);
ei_end_tab();
tag = eiNULL_TAG;
ei_declare("v",2,5, &tag);
tag = ei_tab(EI_DATA_TYPE_SCALAR, 1024);
//tag=228
ei_variable("v", &tag);
ei_tab_add_scalar(0);
ei_tab_add_scalar(0);
ei_tab_add_scalar(1);
ei_tab_add_scalar(1);
ei_end_tab();
//### triangles, size=[1, 1]
tag = ei_tab(EI_DATA_TYPE_INDEX, 1024);
//tag=230
ei_triangle_list(230);
ei_tab_add_index(0);
ei_tab_add_index(1);
ei_tab_add_index(2);
ei_tab_add_index(2);
ei_tab_add_index(1);
ei_tab_add_index(3);
ei_end_tab();
}//pPlaneShape11_object
ei_end_object();
//--------------------------
ei_instance("pPlaneShape11");
ei_add_material("liquidSurface24SG");
ei_element("pPlaneShape11_object");
ei_transform(9.6133,0,0,0, 0,1,0,0, 0,0,8.02763,0, -2.76716,0,-0.566055,1);
//ribNode->doDef=205, ribNode->doMotion=205
ei_motion(1);
ei_end_instance();
//

//Renderer::worldEpilogue()
ei_instgroup("perspShape");
//camera
ei_add_instance("|persp|perspShape");
//lightlinks and meshes
ei_add_instance("|pointLight1|pointLightShape1");
ei_add_instance("|pointLight2|pointLightShape2");
ei_add_instance("pPlaneShape11");
ei_end_instgroup( );
// in batch render mode
ei_render("perspShape", "|persp|perspShape", "perspShape_option");