I'm just testing how I can save memory with placeholder nodes.
I'm creating a grid ob cubes, first I create the placeholders, and the placeholder instances call the construction of a simple cube.
In my scene I only have the geometry for the geometry shader and default light and a camera.
This method should allow me to use quite a lot of objects without wasting to much memory. But with a grid of 500 by 500 cubes, the memory needed is more than 1 GByte.
After all placeholders are built, ray.exe needs more than 600mb, I think that is a little bit too much.
Below is a part of my placeholder code that is built in shader function.
Code:for( i = 0; i < zei; i++) { for( k = 0; k < spa; k++) { sprintf_s(iname, "Dummy%d_%d", i, k); int id = (i * spa) + k; sprintf_s(oname, "Dummy%d", objCount++); obj = mi_api_object_begin(mi_mem_strdup(oname)); obj->visible = obj->shadow = obj->trace = miTRUE; mi_api_basis_list_clear(); obj->bbox_min.x = obj->bbox_min.y = obj->bbox_min.z = -1; obj->bbox_max.x = obj->bbox_max.y = obj->bbox_max.z = 1; mi_api_object_callback(makegobject, 0); resultObj = mi_api_object_end(); inst = mi_api_instance_begin(mi_mem_strdup(iname)); inst->tf.global_to_local[12] = i * 1; inst->tf.global_to_local[14] = k * 1; mi_matrix_invert(inst->tf.local_to_global, inst->tf.global_to_local); resultInst = mi_api_instance_end(mi_mem_strdup(oname), 0, 0); // instances done geoAddResult = mi_geoshader_add_result(result, resultInst); } } mi_info("---------- Haggi Shader End ---------------");
does anyone have an idea how so save a little bit more memory so that I can create more objects?


Reply With Quote