hhergeth / CudaTracerLib

A library for ray tracing based rendering algorithms using CUDA
GNU General Public License v3.0
50 stars 9 forks source link

model with texture error #15

Closed iscaswcm closed 6 years ago

iscaswcm commented 6 years ago

When rendering model with texture (jpg or png file) , e.g. white oak tree (http://g3d.cs.williams.edu/g3d/data10/index.html), it has following error:

Texture : 404.jpg was not found

After copy texture file from white_oak/*.png to Data, such error disappear, and it output:

In file '/home/wcm/CudaTracerLib-related/CudaTracerLib/Kernel/PixelVarianceBuffer.cu' at line 30 : an illegal memory access was encountered In file '/home/wcm/CudaTracerLib-related/CudaTracerLib/Kernel/Tracer.cpp' at line 30 : an illegal memory access was encountered terminate called after throwing an instance of 'std::runtime_error' what(): In file '/home/wcm/CudaTracerLib-related/CudaTracerLib/Kernel/Tracer.cpp' at line 30 : an illegal memory access was encountered

.........................

I have tried to test another model San_Miguel, it has above mentioned error.

@hhergeth

iscaswcm commented 6 years ago

fixed it, I will give a note about it when working tomorrow.

iscaswcm commented 6 years ago

This error usually occurs when no light is set in scene. So, when models without a light source, Adding following line: //check whether light exist or not int numLights = scene.getLightCount(); if(numLights == 0) { log.logInfo("WARNING: NO LIGHT EXISTS IN SCENE, AUTOMATELY ADD INFINITEAREALIGHT!!!!!!"); //an enviornement map can be scaled by a constant factor scene.setEnvironementMap(Spectrum(1), "sky_white.exr"); }

detailed info see https://github.com/iscaswcm/example_use_CudaTracerLib

iscaswcm commented 6 years ago

Fix texture 404.jpg error:

virtual std::string getTexturePath(const std::string& name) { return texture_path + name; }

see https://github.com/iscaswcm/example_use_CudaTracerLib for further info.