ladybug-tools / spider

:spider_web: 3D interactive analysis in your browser mostly written around the Three.js JavaScript library
http://www.ladybug.tools/spider
44 stars 15 forks source link

Update 2018-08-23/27~ RAD to Three.js R3 << R5 #142

Closed theo-armour closed 5 years ago

theo-armour commented 6 years ago

@mostaphaRoudsari

It would be a nice thing if we could get this script ready for you to show at The 17th International Radiance Workshop

Radiance RAD to Three.js R3

Radiance RAD to Three.js Read Me

Where do we go from here?

Everything in the to do list will get done eventually. The following some questions that could use some answers prior to the Radiance Workshop

Are there others? The main thing is this: what should be just the next two or three priority items to be tackled in the next few days/next release or two?

Help Wanted

mostaphaRoudsari commented 5 years ago

@theo-armour, we have a very short time between now and the workshop so and I totally agree with your comments to find the most important ones first to address. Here are my comments.

  • Repo Should this code move into its own repo and become a proper issue-driven development project?

I think it should happen sooner than later. It is a very interesting project and I think keep it separate and small can be very helpful both as a viewer and a learning resource (for getting started with THREE.js). I'm being selfish here and want to use this project to learn THREE.js

  • Geometry RAD files may contain spheres, cones and other types of geometry. The current version of this viewer only supports polygons. It would be a good thing to decide the priority for the addition of support for other types of geometry. Should support for these geometries be added ASAP or are these types infrequently used and their inclusion might even be a distraction in a AEC domain-specific environment?

We can add a couple of commonly used geometries such as sphere, cone and Cylinder and we will cover most of the cases. I assume are easy to support these primitive geometries in THREE.js. I can add them to parser later today/tonight.

  • Materials RAD files support a variety of materials and colors but gbXML and Honeybee are only likely to used a small number of these. It would be a good thing to decide the priority for the addition of support for other types of materials. Should the viewer be able to parse all Radiance material types ASAP or is it sufficient for the time being to have a simple hard-wired lookup table for 50 or so commonly used materials?

There are several type of materials in Radiance and I propose that for now parse all of them with a generic structure. All we need is that all the geometries with the same material name to be colored the same in the viewer. Also it would be very nice if material definition shows up on mouse hover.

I will add more info in rad_2_json repository.

  • File Size The current viewer is setup for files up 1 to 2 MB in size. It can be updated to handle files of much larger size but this would come at cost of greater complexity and more safeguards. Would this effort be worthwhile in the near term of not?

For now and as a prototype I think this is all we need. Once moved to its own repository we can start thinking about heavier files.

  • More Permalinks, drag and drop and so on. Many of these little feature will just drop in organically as revisions keep coming out.

I would keep these cool feature for later and after the basic viewer works but you know better if we should implement them sooner than later. In my list they will be down there in the bottom.

Access to more RAD files created using Ladybug tools or by frequently used energy analysis programs

I can gradually add more radiance sample files but in reality the structure is always the same. Only the size will change.

Ok. Let me add more geometry support and separate materials and then I will add a new post here.

mostaphaRoudsari commented 5 years ago

Forgot to share this link: http://radsite.lbl.gov/radiance/refer/ray.html#Materials

mostaphaRoudsari commented 5 years ago

@theo-armour, here is the first round of developments. It should address all the comments that I made above. Now most of common material types and surface types are supported and the output separates surfaces from materials.

See this: https://github.com/mostaphaRoudsari/rad-to-json/commit/05dcacb8e6c5cf49b8aaed0c2e56b6878db28630

mostaphaRoudsari commented 5 years ago

PS: This is beautiful: https://github.com/ladybug-tools/spider/blob/master/cookbook/rad-to-threejs/r3/rad-to-three.js It's really easy to follow and see how the magic happens.

theo-armour commented 5 years ago

@mostaphaRoudsari

Thank you for the detailed reply and the wonderful new coding effort.

See:

Radiance RAD to Three.js R4

image whale has cones at nose and tail

This release loads a simplified version of your radconverter.js. This release is only just beginning to take advantage of the new capabilities and is buggy.

The next release should complete accessing the geometry and, fingers crossed, make a good start at adding materials.

Also coming: the new repo. I am thinking that 'Spider RAD Tools' might be a good title. Individual projects could be named like this: Spider '' . This would be similar to Spider 'Aragog' gbXML Viewer.

More tomorrow...

mostaphaRoudsari commented 5 years ago

@theo-armour, Very nice! thanks. Looking forward to the new version. What about 'Spider RAD Viewer' since this will only be a viewer and not series of tools.

Also in my first release I didn't apply all the changes to Polygons and vertices were loaded as [a, b, c]. Now that is fixed to match all the other geometries. https://github.com/mostaphaRoudsari/radJSON/commit/ac0ea4df1e10985e5a1cfc4f3e65197f14237c01

@sariths and @zati89, Do you have a number of radiance models that includes spheres, cones, etc for testing?

zati89 commented 5 years ago

hi @mostaphaRoudsari @theo-armour , link for the ellipsoid geometry https://send.firefox.com/download/0f77be1801/#dU9V9b0lPeSzNfLh25WpGw 174 ellipsoids in. done by hermite curves and genrev

Let me know if you want also some Native Radiance Cone/sphere

mostaphaRoudsari commented 5 years ago

Hi @zati89,

ellipsoids are not supported yet. See here for the list of supported primitives: https://github.com/mostaphaRoudsari/radJSON#supported-surface-types

So yes. native cone/sphere will be highly appreciated.

zati89 commented 5 years ago

Hi @mostaphaRoudsari , @theo-armour https://send.firefox.com/download/0ee3df0902/#FLdvNOR8_O9ad0UHeNeeTw some geometry with highly appreciated Spheres and cylinders a.k.a TREES :)

mostaphaRoudsari commented 5 years ago

Great! Thanks. @theo-armour use this file which is the same file that @zati89 updated after adding a number of missing new lines: Mostapha_forest_Sphere.txt

zati89 commented 5 years ago

HI @theo-armour , Just had a look into the example files, and , wow , superb. Can you add maybe also material selection/filtering ? So one can turn on and Off them. Thanks and keep up with the good work. Peter Z

theo-armour commented 5 years ago

@mostaphaRoudsari @zati89

Thanks to both of you for the files and kind words.

image

2018-08-19: Full Screen: Radiance RAD to Three.js R5

Notes

This script is beginning to mature. It handles a good starting range of Radiance geometries and materials and displays the data as expected in most instances. There are still issues with files over a megabyte in size as well as odd errors with individual surface - particularly with files exported from OpenStudio.

The step will be to mve the files to a new separate repository.

> > I am thinking that 'Spider RAD Tools' might be a good title.

> What about 'Spider RAD Viewer' since this will only be a viewer and not series of tools?

@mostaphaRoudsari: I suggested 'tools' because I plan to fork all the Radiance sample files to the new repo. I also plan to add a page one useful radiance related links. And, fingers crossed, you will for your rad to json efforts to the repo so that:

  1. Peeps can see different coding styles in poeration
  2. A schema for Radiance JSON that can be applied to any 3D app - not just Three.js - can be built up

And why not start building a RAD file editor as well? Just as we have going with the gbXML 'Viewer'. ;-)

image

mostaphaRoudsari commented 5 years ago

@theo-armour,

Look at those trees. Very nice!

@mostaphaRoudsari: I suggested 'tools' because I plan to fork all the Radiance sample files to the new repo. I also plan to add a page one useful radiance related links. And, fingers crossed, you will for your rad to json efforts to the repo so that:

Peeps can see different coding styles in operation A schema for Radiance JSON that can be applied to any 3D app - not just Three.js - can be built up

And why not start building a RAD file editor as well? Just as we have going with the gbXML 'Viewer'. ;-)

You have a long-term plan as usual ;-). Your argument for Tools vs Viewer is convincing. At the same time I would suggest to keep the repositories separate and small and then have a repository/web page that brings them together under a single page as Tools.

I say this since in that structure it is easier to:

  1. Keep the code clean.
  2. Test the code.
  3. Learn from the code and hack it for other uses.
  4. And finally use the repository as a dependency. Especially when it comes to JavaScript we can use GitHub submodules functionality between the repositories.

The idea of editor is great and will be useful but again my suggestion is to keep the viewer project separate and light. For start all we need is a viewer to load and quality check the model and can be integrated in other tools as a lightweight viewer.

Unlike gbXML we currently have great editors for Rad files (I know they are not web-based but still :-) ) and then once we have a stable viewer we can start the editor project. How does that sound to you.

theo-armour commented 5 years ago

@mostaphaRoudsari

All sounds good. A new repo is up. I will 'announce' it in a new issue