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

rad viewer 10 ~ 2018-05-23 #118

Closed
theo-armour opened this issue May 10, 2018 · 16 comments
Closed

rad viewer 10 ~ 2018-05-23 #118

theo-armour opened this issue May 10, 2018 · 16 comments
Labels
Rad Viewer A webbased viewer for radiance input files Solar Study updates

Comments

@theo-armour
Copy link
Member

@ladybug-tools/spiders

image

full screen: Rad Viewer 4

Source code

  • Handles polygons with any number of vertices
  • Adds opacity slider
  • Adds edges and edges toggle
  • Add link to sample files
@theo-armour
Copy link
Member Author

@ladybug-tools/spiders

full screen: rad viewer 6

image

  • Open files using file dialog box
  • Open files via URL as a location.hash string
  • Links to nine sample files
  • Now ignores geometry it does not know how to draw

There are still a number of geometry primitives to be added. Once these are completed then materials will start to be added

image

@mdengusiak
Copy link
Member

@theo-armour
It get better with recognition london-office.rad... only few more to solve and we get perfect geometry in RAD :)

@theo-armour theo-armour changed the title rad viewer 4 rad viewer 7 May 15, 2018
@theo-armour
Copy link
Member Author

rad viewer 7

  • Now loads files asynchronously with no issues
  • More demo files added from rndmStff
  • Zoom all button added
  • Various minor tweaks to help with loading added

manhattan1

@theo-armour
Copy link
Member Author

@ladybug-tools/spiders

rad viewer 8

image

  • Adds very basic color rendering - plastic only - no specular, no sky and no lights etc yet
  • More demo files added from gjward1
  • Improved data parsing

image

@mdengusiak
Copy link
Member

@theo-armour
absolutely great!

@theo-armour theo-armour changed the title rad viewer 7 rad viewer 8 May 18, 2018
@mostaphaRoudsari
Copy link
Member

@theo-armour, This looks great! I can see that it fails to create the polygons with holes. That's a common practice in radiance that we should take care of it at some point.

@theo-armour theo-armour added the Rad Viewer A webbased viewer for radiance input files label May 19, 2018
@theo-armour
Copy link
Member Author

@mostaphaRoudsari

I can see that it fails to create the polygons with holes.

Ha ha! This is computer graphics - a topic certainly full of holes.

Actually Radiance polygons do not support holes.

From: http://radsite.lbl.gov/radiance/refer/refman.pdf

Polygon
A polygon is given by a list of three-dimensional vertices, which are ordered counter-clockwise as
viewed from the front side (into the surface normal). The last vertex is automatically connected to the first. Holes are represented in polygons as interior vertices connected to the outer perimeter by coincident edges (seams).

In other words Radiance does not draw holes it just pretends to draw them. Radiance always triangulates the entire boundary. If, however, you draw your boundary very carefully it looks as if there is a hole.

For the most part Three.js Shapes can do this too. But the Shape geometry also supports actual holes. So it puts a condition on the drawing direction. It asks you to draw the Shape clockwise or counterclockwise.

Looking at the Radiance examples that I have, I see that with some geometries both the outside and the 'hole' are both drawn in the sane direction and other geometries even in the same example, the outside is drawn in one direction and the inside is drawn in the opposite direction.

Here is a graphic example of what I am seeing:

image

Here is an example of a wall where the lower surface with two openings is turned into multiple triangular faces and the upper surface with one opening is rendered as one polygon with a fake hole.

image

I think I am going to have a jolly good time trying to fix this one.

@theo-armour
Copy link
Member Author

So it looks like the Radiance polygons where the false openings occur may be identified because they have ten or more vertices and at least two pairs of vertices are duplicates.

image

The interesting thing is that sometimes the Three.js shapes are two overlapping triangles and sometimes two overlapping rectangles and sometimes they are drawn correctly.

@mostaphaRoudsari
Copy link
Member

@theo-armour, as usual you're making progress faster than what I can keep up with. :)

Yes. They will always have two pair of duplicate vertices. Here is a sample that shows how a polygon is structured:

exported_300

The interesting thing is that sometimes the Three.js shapes are two overlapping triangles and sometimes two overlapping rectangles and sometimes they are drawn correctly.

Not sure how you triangulate them but if you're picking every three vertices it is most likely because different polygons have different starting point.

Does THREE.js support creating planar mesh from a closed polygon?

@bwelle
Copy link
Collaborator

bwelle commented May 20, 2018 via email

@mostaphaRoudsari
Copy link
Member

@bwelle , that is a different case which won't be part of this issue. In that case the parent surface will be a surface and openings with antimatter material will show up as surfaces which will overlap with the parent surface. We're discussing problematic polygons with holes that follow this definition:

Holes are represented in polygons as interior vertices connected to the outer perimeter by coincident edges (seams).

@theo-armour
Copy link
Member Author

@mostaphaRoudsari

Thank you for the animated illustration of how holes are created in Radiance.

The interesting thing is that Radiance appears to be very flexible with polygons that start at a low vertex or a high vertex, with vertices that run clockwise or counter clockwise, with 'holes' where the vertices that run in the same direction as the outer vertices or in the opposite direction.

In other words, it appears to me, Radiance allows you to draw polygons anyway you want. Note: I'm only a few days into radiance. Anyway, this is wonderful.

I guess that one reason for this great flexibility may be that Radiance does not support actual topological holes in polygons. In any case, It's likely to take me a while to match this flexibility with Three.js but I do see resolution as being insurmountable.

Does THREE.js support creating planar mesh from a closed polygon?

Yes.

The issue is that although Three.js shapes may be positioned anywhere in 3D space, they must be created using only X and Y. Both the gbXML Viewer and Rad Viewer use functions that I write and maintain that take co-planer polygons in space, do all manner of things including - would you believe - 'conjugating their quaternions' to get them into flatland, and then do all manner of things to get the 2D shape into where it's meant to be back in 3D space.

I must say that I take great pride in this piece of code and it is the core and the mainstay of both viewers or a number of months. I have considered it a solid piece of linear algebra brevity and simplicity. Unfortunately for this code, I think, last night I found a way of writing the same thing even shorter, faster and smarter. So it goes.

The nice thing is that I came up with this while trying to deal with Greg Ward's polygons. I think I will be testing the code out while making the new viewer render the polygons more nicely,

@theo-armour
Copy link
Member Author

@ladybug-tools/spiders

image

full screen: rad viewer 9

  • Draws 'holes' correctly
    • Uses ad hoc rules to reorder vertices
    • Appears to display the geometry of all the examples provided in the menu as expected (but may not complete on very large files )
    • Maintains reasonable speed

If the display of the geometry is not working for you, kindly send a link to a file that exhibits the issue.

@mdengusiak

What are program are you using to create your Rad files?

@theo-armour theo-armour changed the title rad viewer 8 rad viewer 9 ~ 2018-05-22 May 23, 2018
@mdengusiak
Copy link
Member

@theo-armour
this is ABSOLUTELY AMAZING!!!!!
Viewer is now fully solved for my all projects!!! THANKS

All my files are from: Revit - gbXML - Honeybee - Radiance
few old one link warwick / hour-13-0.rad where from Revit - Rhino - Radiance

I have now idea... do you think we could now see if some additional vertices can be removed and therefore surfaces simplified. Here we can see clearly that most of facade looks great only few parts causing issues?
image

@theo-armour
Copy link
Member Author

@mdengusiak

I'm happy you are happy

do you think we could now see if some additional vertices can be removed and therefore surfaces simplified

Why not just just press the 'toggle edges' button? Perhaps edges display off should be the default.

@theo-armour theo-armour changed the title rad viewer 9 ~ 2018-05-22 rad viewer 10 ~ 2018-05-23 May 24, 2018
@theo-armour
Copy link
Member Author

image
Radiance RAD files with PTS data added as white-colored Three.js Sprites - all very work-in-progress

full screen: rad viewer 10

  • Rendering JavaScript extracted into separate file and namespaced ( made code safer and more reusable)
  • Add ability to load and display PTS files with data displayed as Three.js Sprites
    • Reduce the opacity in order to view PTS data
    • Note: loading of RES files not yet supported

Working methods for associating PTS and RES data to the Three.js meshes is likely to be interesting. Just remember that Rome was not built in a day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rad Viewer A webbased viewer for radiance input files Solar Study updates
Projects
None yet
Development

No branches or pull requests

4 participants