joonsrenderer 1.1.1-java → 1.1.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +1 -1
- data/docs/_posts/2017-01-06-media.md +101 -0
- data/docs/_posts/2017-01-08-resources.md +4 -2
- data/docs/assets/media_captured.png +0 -0
- data/docs/assets/media_rendered.png +0 -0
- data/lib/joonsrenderer/version.rb +1 -1
- data/pom.rb +2 -2
- data/pom.xml +2 -2
- data/src/main/java/joons/JRFiller.java +15 -23
- data/src/main/java/joons/JoonsRenderer.java +5 -5
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7619bcb28e30d6facafc84f6a4237dfe1b51bbc
|
4
|
+
data.tar.gz: 0c4c0910518f2e693e4fb43a46f82f97b64fef1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f63b2a97ada796e0ccb967b8a616ff98d98dbff79dd3726999c26c0e44954cd9dffca0575f41ed8afa49a38cd0d04d820d50db1c0bf69eec0459f887f78428f7
|
7
|
+
data.tar.gz: ee8762e7ff242c4920f91917c326a4394748b070c17ee8d6af87b54f3e0a23158f4afbfdf8f57f601244c22f41f537cfb269793853a8673206db5ce553e5d4f1
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# joonsrenderer
|
2
|
-
gem to use sunflow (raytacer) with JRubyArt and propane
|
2
|
+
A gem to use the sunflow (raytacer) with JRubyArt and propane. Pretty quick and dirty stuff, if you are really serious you might choose to export processing sketch to some 3D format, parse that through [MeshLab](http://www.meshlab.net/) to clean it up before rendering with [blender](https://www.blender.org/) but for everyone else this is pretty easy.
|
@@ -0,0 +1,101 @@
|
|
1
|
+
---
|
2
|
+
layout: post
|
3
|
+
title: "Media Demo"
|
4
|
+
date: 2017-01-08 04:31:13
|
5
|
+
categories: joonsrenderer update
|
6
|
+
---
|
7
|
+
Sunflow is an open source global illumination rendering system written in Java written by [Christopher Kulla][fpsunflower]. I have recently updated to [build with maven][maven] using jdk-8 and to use the latest [janino jars][janino]. This is gem makes sunflow rendering easily available to `JRubyArt` and `propane` users using Joon Hylub Lees [joons-renderer][joons]:-
|
8
|
+
|
9
|
+
### media_demo.rb (JRubyArt Sketch)
|
10
|
+
```ruby
|
11
|
+
require 'joonsrenderer'
|
12
|
+
include_package 'joons'
|
13
|
+
|
14
|
+
attr_reader :jr, :eye, :center, :up
|
15
|
+
|
16
|
+
def setup
|
17
|
+
sketch_title 'Media Demo'
|
18
|
+
@jr = JoonsRenderer.new(self)
|
19
|
+
jr.set_sampler('ipr') # Rendering mode, either 'ipr' or 'bucket'.
|
20
|
+
jr.set_size_multiplier(2) # Set size of PNG file as a multiple of Processing sketch size.
|
21
|
+
jr.setAA(-2, 0) # Set anti aliasing, (aaMin, aaMax, aaSamples). aaMin & aaMax = .. -2, -1, .. , 1, 2 .. aaMin < aaMax.
|
22
|
+
jr.set_caustics(10) # Set caustics. 1, 5, 10 .., affects quality of light reflected & refracted through glass.
|
23
|
+
# Camera Setting.
|
24
|
+
@eye = Vec3D.new(0, 0, 120)
|
25
|
+
@center = Vec3D.new(0, 0, -1)
|
26
|
+
@up = Vec3D.new(0, 1, 0)
|
27
|
+
end
|
28
|
+
|
29
|
+
def draw
|
30
|
+
jr.begin_record # Make sure to include things you want rendered.
|
31
|
+
kamera(eye: eye, center: center, up: up)
|
32
|
+
perspektiv(fov: PI / 4.0, aspect_ratio: 4 / 3.0, near_z: 5, far_z: 10_000)
|
33
|
+
jr.background('gi_instant') # Global illumination.
|
34
|
+
jr.background('cornell_box', 100, 100, 100) # Cornell box, width, height, depth.
|
35
|
+
push_matrix
|
36
|
+
translate(-40, 20, -20)
|
37
|
+
push_matrix
|
38
|
+
rotateY(-PI / 8)
|
39
|
+
# jr.fill('light', r, g, b)
|
40
|
+
jr.fill('light', 5, 5, 5)
|
41
|
+
sphere(13)
|
42
|
+
translate(27, 0, 0)
|
43
|
+
# jr.fill('mirror', r, g, b)
|
44
|
+
jr.fill('mirror', 255, 255, 255)
|
45
|
+
sphere(13)
|
46
|
+
translate(27, 0, 0)
|
47
|
+
# jr.fill('diffuse', r, g, b)
|
48
|
+
jr.fill('diffuse', 150, 255, 255)
|
49
|
+
sphere(13)
|
50
|
+
translate(27, 0, 0)
|
51
|
+
# jr.fill('shiny', r, g, b, shininess)
|
52
|
+
jr.fill('shiny', 150, 255, 255, 0.1)
|
53
|
+
sphere(13)
|
54
|
+
translate(27, 0, 0)
|
55
|
+
pop_matrix
|
56
|
+
rotateY(PI / 8)
|
57
|
+
translate(-10, -27, 30)
|
58
|
+
# jr.fill('ambient occlusion', bright r, g, b, dark r, g, b, maximum distance, int samples)
|
59
|
+
jr.fill('ambient_occlusion', 150, 255, 255, 0, 0, 255, 50, 16)
|
60
|
+
sphere(13)
|
61
|
+
translate(27, 0, 0)
|
62
|
+
# jr.fill('phong', r, g, b)
|
63
|
+
jr.fill('phong', 150, 255, 255)
|
64
|
+
sphere(13)
|
65
|
+
translate(27, 0, 0)
|
66
|
+
# jr.fill('glass', r, g, b)
|
67
|
+
jr.fill('glass', 255, 255, 255)
|
68
|
+
sphere(13)
|
69
|
+
translate(27, 0, 0)
|
70
|
+
# jr.fill('constant', r, g, b)
|
71
|
+
jr.fill('constant', 150, 255, 255)
|
72
|
+
sphere(13)
|
73
|
+
pop_matrix
|
74
|
+
jr.end_record # Make sure to end record.
|
75
|
+
# Display rendered image if render is completed, and the argument is true.
|
76
|
+
jr.display_rendered(true)
|
77
|
+
end
|
78
|
+
|
79
|
+
def key_pressed
|
80
|
+
jr.render if (key == 'r' || key == 'R') # Press 'r' key to start rendering.
|
81
|
+
end
|
82
|
+
|
83
|
+
def settings
|
84
|
+
size(800, 600, P3D)
|
85
|
+
end
|
86
|
+
|
87
|
+
```
|
88
|
+
|
89
|
+
### The Processing Sketch
|
90
|
+
|
91
|
+
<img src="{{site.github.url}}/assets/media_captured.png" />
|
92
|
+
|
93
|
+
### The RayTraced Image
|
94
|
+
|
95
|
+
<img src="{{site.github.url}}/assets/media_rendered.png" />
|
96
|
+
|
97
|
+
[fpsunflower]:http://sunflow.sourceforge.net/
|
98
|
+
[maven]:https://github.com/monkstone/sunflow
|
99
|
+
[joons]:https://github.com/joonhyublee/joons-renderer
|
100
|
+
[janino]:http://janino-compiler.github.io/janino/
|
101
|
+
[github]:https://github.com/monkstone/joonsrenderer
|
@@ -4,9 +4,11 @@ title: "Resource References"
|
|
4
4
|
date: 2017-01-08 05:00:13
|
5
5
|
categories: joonsrenderer update
|
6
6
|
---
|
7
|
-
Get some inspiration on [flickr][flickr] and [vimeo][vimeo] (and by [Joon Hyub Lee][joonsvimeo]). See also this [tutorial][
|
7
|
+
Get some inspiration on [flickr][flickr] and [vimeo][vimeo] (and by [Joon Hyub Lee][joonsvimeo]). See also this [tutorial][tutorial] by Joon Hyub Lee
|
8
|
+
and this link to a [pdf][wiki] of a defunct wiki from a sunflow developer.
|
8
9
|
|
9
10
|
[flickr]:https://www.flickr.com/search/?text=sunflow
|
10
11
|
[joonsvimeo]:https://vimeo.com/user4562261
|
11
12
|
[vimeo]:https://vimeo.com/search?q=sunflow
|
12
|
-
[
|
13
|
+
[tutorial]:https://github.com/joonhyublee/joons-renderer/wiki
|
14
|
+
[wiki]:https://geneome.com/sunflow-wiki/
|
Binary file
|
Binary file
|
data/pom.rb
CHANGED
@@ -2,11 +2,11 @@ require 'fileutils'
|
|
2
2
|
project 'joonsrenderer' do
|
3
3
|
|
4
4
|
model_version '4.0.0'
|
5
|
-
id 'joons:joonsrenderer:1.1.
|
5
|
+
id 'joons:joonsrenderer:1.1.2'
|
6
6
|
packaging 'jar'
|
7
7
|
description 'joonsrenderer for propane and JRubyArt'
|
8
8
|
organization 'ruby-processing', 'https://ruby-processing.github.io'
|
9
|
-
{ 'fpsunflower' => 'Christopher Kulla', 'geneome' => '
|
9
|
+
{ 'fpsunflower' => 'Christopher Kulla', 'geneome' => 'Eugene Reilly', 'joonhyublee' => 'Joon Hyub Lee', 'monkstone' => 'Martin Prout' }.each do |key, value|
|
10
10
|
developer key do
|
11
11
|
name value
|
12
12
|
roles 'developer'
|
data/pom.xml
CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
11
11
|
<modelVersion>4.0.0</modelVersion>
|
12
12
|
<groupId>joons</groupId>
|
13
13
|
<artifactId>joonsrenderer</artifactId>
|
14
|
-
<version>1.1.
|
14
|
+
<version>1.1.2</version>
|
15
15
|
<name>joonsrenderer</name>
|
16
16
|
<description>joonsrenderer for propane and JRubyArt</description>
|
17
17
|
<organization>
|
@@ -34,7 +34,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
34
34
|
</developer>
|
35
35
|
<developer>
|
36
36
|
<id>geneome</id>
|
37
|
-
<name>
|
37
|
+
<name>Eugene Reilly</name>
|
38
38
|
<roles>
|
39
39
|
<role>developer</role>
|
40
40
|
</roles>
|
@@ -1,24 +1,24 @@
|
|
1
1
|
package joons;
|
2
2
|
|
3
|
-
import
|
4
|
-
import
|
3
|
+
import org.sunflow.util.FloatArray;
|
4
|
+
import org.sunflow.util.IntArray;
|
5
5
|
|
6
6
|
public class JRFiller {
|
7
7
|
|
8
|
-
private final
|
9
|
-
private final
|
10
|
-
private final
|
11
|
-
private final
|
8
|
+
private final FloatArray vertices;
|
9
|
+
private final IntArray triangleIndices;
|
10
|
+
private final FloatArray spheres;
|
11
|
+
private final FloatArray points;
|
12
12
|
|
13
13
|
private final String fillType;
|
14
14
|
public float[] p; //array of parameters
|
15
15
|
public int np = 0; //number of parameters
|
16
16
|
|
17
17
|
public JRFiller(String fillType, float... params) {
|
18
|
-
vertices = new
|
19
|
-
triangleIndices = new
|
20
|
-
spheres = new
|
21
|
-
points = new
|
18
|
+
vertices = new FloatArray();
|
19
|
+
triangleIndices = new IntArray();
|
20
|
+
spheres = new FloatArray();
|
21
|
+
points = new FloatArray();
|
22
22
|
|
23
23
|
this.fillType = fillType;
|
24
24
|
p = params;
|
@@ -29,12 +29,12 @@ public class JRFiller {
|
|
29
29
|
return fillType;
|
30
30
|
}
|
31
31
|
|
32
|
-
public
|
32
|
+
public FloatArray getVertices() {
|
33
33
|
return vertices;
|
34
34
|
}
|
35
35
|
|
36
36
|
private void writeTriangleIndices() {
|
37
|
-
for (int i = 0; i < (vertices.
|
37
|
+
for (int i = 0; i < (vertices.getSize() / 9); i++) {
|
38
38
|
//vertices/3 = number of 3d points
|
39
39
|
//vertices/9 = number of triangles
|
40
40
|
triangleIndices.add(i * 3);
|
@@ -44,20 +44,12 @@ public class JRFiller {
|
|
44
44
|
}
|
45
45
|
|
46
46
|
public float[] verticesToArray() {
|
47
|
-
|
48
|
-
for (int i = 0; i < vertices.size(); i++) {
|
49
|
-
v[i] = vertices.get(i);
|
50
|
-
}
|
51
|
-
return v;
|
47
|
+
return vertices.trim();
|
52
48
|
}
|
53
49
|
|
54
50
|
public int[] triangleIndicesToArray() {
|
55
51
|
writeTriangleIndices();
|
56
|
-
|
57
|
-
for (int i = 0; i < triangleIndices.size(); i++) {
|
58
|
-
t[i] = triangleIndices.get(i);
|
59
|
-
}
|
60
|
-
return t;
|
52
|
+
return triangleIndices.trim();
|
61
53
|
}
|
62
54
|
|
63
55
|
public void addSphere(float x, float y, float z, float r) {
|
@@ -67,7 +59,7 @@ public class JRFiller {
|
|
67
59
|
spheres.add(r);
|
68
60
|
}
|
69
61
|
|
70
|
-
public
|
62
|
+
public FloatArray getSpheres() {
|
71
63
|
return spheres;
|
72
64
|
}
|
73
65
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
package joons;
|
2
2
|
|
3
|
-
import
|
3
|
+
import org.sunflow.util.FloatArray;
|
4
4
|
|
5
5
|
import org.sunflow.SunflowAPI;
|
6
6
|
import org.sunflow.math.Matrix4;
|
@@ -662,8 +662,8 @@ public class JoonsRenderer {
|
|
662
662
|
}
|
663
663
|
|
664
664
|
//light spheres
|
665
|
-
|
666
|
-
int noOfSpheres = (int) spheres.
|
665
|
+
FloatArray spheres = temp.getSpheres();
|
666
|
+
int noOfSpheres = (int) spheres.getSize() / 4;
|
667
667
|
|
668
668
|
for (int j = 0; j < noOfSpheres; j++) {
|
669
669
|
float x = spheres.get(j * 4);
|
@@ -802,8 +802,8 @@ public class JoonsRenderer {
|
|
802
802
|
api.instance("Object_" + i + ".instance", "Object_" + i);
|
803
803
|
|
804
804
|
//render the respective spheres
|
805
|
-
|
806
|
-
int noOfSpheres = spheres.
|
805
|
+
FloatArray spheres = temp.getSpheres();
|
806
|
+
int noOfSpheres = spheres.getSize() / 4;
|
807
807
|
|
808
808
|
for (int j = 0; j < noOfSpheres; j++) {
|
809
809
|
float x = spheres.get(j * 4);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: joonsrenderer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- monkstone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A realistic ray tracer for propane and JRubyArt
|
14
14
|
email:
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- docs/_layouts/default.html
|
37
37
|
- docs/_layouts/page.html
|
38
38
|
- docs/_layouts/post.html
|
39
|
+
- docs/_posts/2017-01-06-media.md
|
39
40
|
- docs/_posts/2017-01-08-animated_ray_tracing.md
|
40
41
|
- docs/_posts/2017-01-08-resources.md
|
41
42
|
- docs/_posts/2017-01-08-welcome.md
|
@@ -47,6 +48,8 @@ files:
|
|
47
48
|
- docs/assets/Animation.png
|
48
49
|
- docs/assets/basic.png
|
49
50
|
- docs/assets/basic_traced.png
|
51
|
+
- docs/assets/media_captured.png
|
52
|
+
- docs/assets/media_rendered.png
|
50
53
|
- docs/css/main.scss
|
51
54
|
- docs/favicon.ico
|
52
55
|
- docs/feed.xml
|
@@ -294,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
294
297
|
version: '0'
|
295
298
|
requirements: []
|
296
299
|
rubyforge_project:
|
297
|
-
rubygems_version: 2.6.
|
300
|
+
rubygems_version: 2.6.8
|
298
301
|
signing_key:
|
299
302
|
specification_version: 4
|
300
303
|
summary: From Sketch to Ray Traced Image
|