Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photon Mapping for CAD surface #91

Open
george-94 opened this issue Jun 26, 2017 · 7 comments
Open

Photon Mapping for CAD surface #91

george-94 opened this issue Jun 26, 2017 · 7 comments

Comments

@george-94
Copy link

I have been running a script with no errors on a model created on tonatiuh. However, when I recreated the model and imported it as a CAD surface, the script continues to work fine but the selected surfaces do not save/export the photon map (no .dat file is created). Is there a different way to export CAD surfaces for photon mapping ?

This is the script I am running:

tonatiuh.Open("C:/Users/george/Desktop/solarus simulations/Model.tnh" );

for( var a= 0; a<=180; a=a+10 ){

aa = 90 + a;

for( var e= 0; e<=180; e=e+10){
ee = -90 + e;

var Flat_RectangleB = "//SunNode/Ynode/Xnode/Absorber/Top/TShapeKit1"
tonatiuh.AddExportSurfaceURL(Flat_RectangleB);

var Flat_RectangleF = "//SunNode/Ynode/Xnode/Absorber/Bottom/TShapeKit1"
tonatiuh.AddExportSurfaceURL(Flat_RectangleF);

//First define latitude and then longitude
tonatiuh.ChangeSunPosition ( aa, ee);

/Define ray tracing options/
//Number of rays to trace into each iteration
tonatiuh.SetRaysPerIteration( 10000);
//Sun divisions.
tonatiuh.SetRayCastingGrid( 200, 200 );
//type of random
tonatiuh.SetRandomDeviateType("Mersenne Twister");
//Draw options
tonatiuh.SetRaysDrawingOptions( false,false );
//Buffer size
//tonatiuh.SetPhotonMapBufferSize( 5000000 );

/Define export parameters/
//The simulation will be saved into a SQL_Database file
tonatiuh.SetExportPhotonMapType("Binary_file");
//The coordinates will be saved into target local coordinates
tonatiuh.SetExportCoordinates( true, false);
//The intersection surface will not saved because only target photons will be saved.
tonatiuh. SetExportIntersectionSurface(true);
//The surface side will also be saved
tonatiuh.SetExportIntersectionSurfaceSide( true );
//Previous and next data is needed
tonatiuh.SetExportPreviousNextPhotonID( true );
//Flat_Rectangle photons will be saved.
//You must define the URL path to Surface node

//Define the directory to SQL_Database files, the files names and the size in photons for the files.
//To define the export directory and file you have to use the function two times.
//Use different le name to save the results of each simulation.
var exportDir = "C:/Users/george/Desktop/solarus simulations/iam model";
tonatiuh.SetExportTypeParameterValue( "ExportDirectory", exportDir );
var fileName = "IAM1";
tonatiuh.SetExportTypeParameterValue( "ExportFile", fileName.concat("", aa,"", ee.toString() ) );
//Increments the photon map for tuned iterations.
tonatiuh.SetIncreasePhotonMap( false );

tonatiuh.Run();

}}

@ilescener
Copy link
Collaborator

Dear george-94

The script you are running looks fine and apparently it doesn't content any spelling errors or wrong use of functions.

Probably the Tonatiuh model may have some mistakes, such as, materials assignation, reflection values, etc. If you want you can send me ([email protected]) the Tonatiuh file and I will do a deeper check.

Kind regards

@george-94
Copy link
Author

Thank you, I will do that

@ilescener
Copy link
Collaborator

Dear George,

I found the issue. There was a silly mistake in the script, the paths to the surfaces were bad written.

var Flat_RectangleB = "//SunNode/Ynode/Xnode/Absorber/Top/cell2/TShapeKit1"
var Flat_RectangleF = "//SunNode/Ynode/Xnode/Absorber/Bottom/cell2/TShapeKit1" 

If you look at the node tree these paths must be like this:

//SunNode/Ynode/Xnode/Aborber/Top/TShapeKit1
//SunNode/Ynode/Xnode/Aborber/Bottom/TShapeKit1

Kind regards
Iñigo

@george-94
Copy link
Author

george-94 commented Jun 29, 2017 via email

@ilescener
Copy link
Collaborator

It sounds weird. But for example, if any ray achieves to these surfaces then there will not be a .dat file, because there's no information to store and this may happen depending on the sun position.
Anyway, I will write what is happening down and will do a further inspection if it happens more frequently.

Kind regards
Iñigo

@george-94
Copy link
Author

george-94 commented Jul 6, 2017 via email

@ChileNeverDie
Copy link

Sorry, I have some similar problem, when I created some .stl model to import into Tonatiuh, the software will not recognize it as a surface, would you please share how you make it happen that you exported the phantom file from the CAD surface?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants