diff --git a/data/assets/scene/digitaluniverse/2dF.asset b/data/assets/scene/digitaluniverse/2dF.asset index b7dac60fe2..2b09ab91ff 100644 --- a/data/assets/scene/digitaluniverse/2dF.asset +++ b/data/assets/scene/digitaluniverse/2dF.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "2dF Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_2dF_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,14 +22,16 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 1.0, 1.0 }, - Transparency = 1.0, + Opacity = 1.0, File = speck .. "/2dF.speck", Texture = textures .. "/point3.png", - ColorMap = speck .. "/lss.cmap", - ColorOption = { "redshift", "prox5Mpc" }, - ColorRange = { { 0.0, 0.075 }, { 1.0, 50.0 } }, + ColorMap = speck .. "/2dF.cmap", + ColorOption = { "redshift", "proximity" }, + ColorRange = { { 0.0, 0.075 }, { 1.0, 25.0 } }, Unit = "Mpc", - ScaleFactor = 508.0 + ScaleFactor = 520.0, + BillboardMaxSize = 4.7, + EnablePixelSizeControl = true }, GUI = { Name = "2dF Galaxies", diff --git a/data/assets/scene/digitaluniverse/2mass.asset b/data/assets/scene/digitaluniverse/2mass.asset index ab68580372..b27311229a 100644 --- a/data/assets/scene/digitaluniverse/2mass.asset +++ b/data/assets/scene/digitaluniverse/2mass.asset @@ -22,7 +22,7 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 0.4, 0.2 }, - Transparency = 1.0, + Opacity = 1.0, File = speck .. "/2MASS.speck", Texture = textures .. "/point3.png", ColorMap = speck .. "/lss.cmap", @@ -31,7 +31,9 @@ local object = { Unit = "Mpc", CorrectionSizeEndDistance = 20.6, CorrectionSizeFactor = 15.0, - ScaleFactor = 508.0 + ScaleFactor = 510.78, + BillboardMaxSize = 11.15, + EnablePixelSizeControl = true }, GUI = { Name = "2MASS Galaxies", diff --git a/data/assets/scene/digitaluniverse/6dF.asset b/data/assets/scene/digitaluniverse/6dF.asset index 20d0ead030..3f9b74256c 100644 --- a/data/assets/scene/digitaluniverse/6dF.asset +++ b/data/assets/scene/digitaluniverse/6dF.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "6dF Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_6dF_speck", - Version = 1 + Version = 2 }) local object = { @@ -21,15 +21,17 @@ local object = { Renderable = { Type = "RenderableBillboardsCloud", Enabled = false, - Color = { 1.0, 1.0, 1.0 }, - Transparency = 1.0, + Color = { 1.0, 1.0, 0.0 }, + Opacity = 1.0, File = speck .. "/6dF.speck", Texture = textures .. "/point3.png", - ColorMap = speck .. "/lss.cmap", - ColorOption = { "redshift", "prox5Mpc" }, - ColorRange = { { 0.0, 0.075 }, { 1.0, 50.0 } }, + ColorMap = speck .. "/6dF.cmap", + ColorOption = { "redshift", "proximity" }, + ColorRange = { { 0.0, 0.075 }, { 1.0, 10.0 } }, Unit = "Mpc", - ScaleFactor = 508.0 + ScaleFactor = 534.0, + BillboardMaxSize = 7.0, + EnablePixelSizeControl = true, }, GUI = { Name = "6dF Galaxies", diff --git a/data/assets/scene/digitaluniverse/abell.asset b/data/assets/scene/digitaluniverse/abell.asset index 187ca33fb8..673f2f57ac 100644 --- a/data/assets/scene/digitaluniverse/abell.asset +++ b/data/assets/scene/digitaluniverse/abell.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Abell Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_abell_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,8 +22,8 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 0.4, 0.2 }, - Transparency = 1.0, - ScaleFactor = 525.0, + Opacity = 1.0, + --ColorMap = speck .. "/abell.cmap", File = speck .. "/abell.speck", Texture = textures .. "/point3.png", LabelFile = speck .. "/abell.label", @@ -36,7 +36,10 @@ local object = { -0.074553778365, -0.080991471307, 0.9939225904, 0.0, 0.67314530211, 0.73127116582, 0.11008126223, 0.0, 0.0, 0.0, 0.0, 1.0 - } + }, + ScaleFactor = 520.0, + BillboardMaxSize = 7.0, + EnablePixelSizeControl = true }, GUI = { Name = "Abell Galaxy Clusters", diff --git a/data/assets/scene/digitaluniverse/alternatestarlabels.asset b/data/assets/scene/digitaluniverse/alternatestarlabels.asset index f96a2c20dc..2289f24eae 100644 --- a/data/assets/scene/digitaluniverse/alternatestarlabels.asset +++ b/data/assets/scene/digitaluniverse/alternatestarlabels.asset @@ -15,7 +15,7 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 1.0, 1.0 }, - Transparency = 0.65, + Opacity = 0.65, LabelFile = speck .. "/stars-altlbl.label", TextColor = { 0.4, 0.4, 0.4, 1.0 }, DrawLabels = true, diff --git a/data/assets/scene/digitaluniverse/backgroundradiation.asset b/data/assets/scene/digitaluniverse/backgroundradiation.asset index 13d893b12e..66a2c70a46 100644 --- a/data/assets/scene/digitaluniverse/backgroundradiation.asset +++ b/data/assets/scene/digitaluniverse/backgroundradiation.asset @@ -6,7 +6,7 @@ local textures = asset.syncedResource({ Name = "Background Radiation Textures", Type = "HttpSynchronization", Identifier = "digitaluniverse_backgroundradiation_textures", - Version = 1 + Version = 2 }) local speck = asset.syncedResource({ @@ -214,7 +214,35 @@ local multiverse_planck_4 = { } +local Halpha = { + Identifier = "HAlpha", + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = {0, 0, 3.14159265359} + } + }, + Renderable = { + Type = "RenderableSphere", + Enabled = false, + Size = 9.2E21, + Segments = 40, + Opacity = 0.4, + Texture = textures .. "/mwHalpha-f.png", + Orientation = "Inside", + UseAdditiveBlending = true, + MirrorTexture = true, + FadeOutThreshold = 0.025, + Background = true + }, + GUI = { + Name = "H Alpha", + Path = "/Milky Way/All Sky Images" + } +} + + assetHelper.registerSceneGraphNodesAndExport(asset, { wmap, cbe, planck, multiverse_planck_1, multiverse_planck_2, multiverse_planck_3, - multiverse_planck_4 + multiverse_planck_4, Halpha }) diff --git a/data/assets/scene/digitaluniverse/clusters.asset b/data/assets/scene/digitaluniverse/clusters.asset index 6c7794eb13..f0bb7ac5ea 100644 --- a/data/assets/scene/digitaluniverse/clusters.asset +++ b/data/assets/scene/digitaluniverse/clusters.asset @@ -6,7 +6,7 @@ local speck = asset.syncedResource({ Name = "Clusters Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_clusters_speck", - Version = 1 + Version = 2 }) local object = { @@ -15,13 +15,19 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 1.0, 1.0 }, - Transparency = 0.65, + Opacity = 0.65, LabelFile = speck .. "/galclust.label", - TextColor = { 0.7, 0.3, 0.0, 1.0 }, + TextColor = { 1.0, 0.44, 0.0, 1.0 }, DrawLabels = true, TextSize = 22, TextMinSize = 8.0, - Unit = "Mpc" + Unit = "Mpc", + TransformationMatrix = { + -0.7357425748, 0.67726129641, 0.0, 0.0, + -0.074553778365, -0.080991471307, 0.9939225904, 0.0, + 0.67314530211, 0.73127116582, 0.11008126223, 0.0, + 0.0, 0.0, 0.0, 1.0 + }, }, GUI = { Name = "Galaxy Cluster Labels", diff --git a/data/assets/scene/digitaluniverse/deepsky.asset b/data/assets/scene/digitaluniverse/deepsky.asset new file mode 100644 index 0000000000..af41b8d18c --- /dev/null +++ b/data/assets/scene/digitaluniverse/deepsky.asset @@ -0,0 +1,75 @@ +local assetHelper = asset.require('util/asset_helper') + +local textures = asset.syncedResource({ + Name = "Deep Sky Objects Textures", + Type = "HttpSynchronization", + Identifier = "digitaluniverse_deepsky_textures", + Version = 1 +}) + +local speck = asset.syncedResource({ + Name = "Deep Sky Objects Speck Files", + Type = "HttpSynchronization", + Identifier = "digitaluniverse_deepsky_speck", + Version = 1 +}) + +local deepSkyPoints = { + Identifier = "DeepSkyObjects", + Renderable = { + Type = "RenderableBillboardsCloud", + Enabled = false, + Color = { 1.0, 1.0, 0.0 }, + Opacity = 0.99, + ScaleFactor = 500.0, + File = speck .. "/dso.speck", + Texture = textures .. "/point3.png", + --ColorMap = speck .. "/tully.cmap", + --ColorMap = speck .. "/lss.cmap", + --ColorOption = { "proximity" }, + --ColorOption = { "prox5Mpc" }, + --ColorRange = { { 1.0, 30.0 } }, + LabelFile = speck .. "/dso.label", + TextColor = { 0.1, 0.4, 0.6, 1.0 }, + TextSize = 20.50, + TextMinSize = 16.0, + Unit = "Mpc", + -- Fade in value in the same unit as "Unit" + --FadeInDistances = { 0.05, 1.0 }, + -- Max size in pixels + BillboardMaxSize = 8.22, + BillboardMinSize = 0.0, + --CorrectionSizeEndDistance = 22.0, + --CorrectionSizeFactor = 10.45 + EnablePixelSizeControl = true + }, + GUI = { + Name = "Deep Sky Objects Points", + Path = "/Universe/Galaxies" + } +} + +local deepSkyImages = { + Identifier = "DeepSkyObjectsImages", + Renderable = { + Type = "RenderablePlanesCloud", + Enabled = false, + Color = { 1.0, 1.0, 1.0 }, + Transparency = 0.99, + ScaleFactor = 1.0, + File = speck .. "/dso.speck", + TexturePath = textures, + Luminosity = "radius", + ScaleLuminosity = 0.001, + Unit = "Mpc", + -- Fade in value in the same unit as "Unit" + --FadeInDistances = {0.001, 0.05010}, + PlaneMinSize = 5.0 + }, + GUI = { + Name = "Deep Sky Objects Images", + Path = "/Universe/Galaxies" + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { deepSkyPoints, deepSkyImages }) diff --git a/data/assets/scene/digitaluniverse/dwarfs.asset b/data/assets/scene/digitaluniverse/dwarfs.asset index 07a68b3c03..507fd039d3 100644 --- a/data/assets/scene/digitaluniverse/dwarfs.asset +++ b/data/assets/scene/digitaluniverse/dwarfs.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Brown Dwarf Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_dwarfs_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,16 +22,21 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 0.4, 0.0, 0.1 }, - Transparency = 0.999, + Opacity = 1.0, File = speck .. "/dwarfs.speck", Texture = textures .. "/point3.png", LabelFile = speck .. "/dwarfs.label", + ColorMap = speck .. "/dwarfs.cmap", + ColorOption = { "typeindex" }, + --ColorRange = { { 1.0, 4.0} }, TextColor = { 0.5, 0.1, 0.2, 1.0 }, TextSize = 14.6, TextMinSize = 10.0, - ScaleFactor = 360, - CorrectionSizeEndDistance = 16.1, - CorrectionSizeFactor = 7.75, + ScaleFactor = 370, + --CorrectionSizeEndDistance = 16.1, + --CorrectionSizeFactor = 7.75, + BillboardMaxSize = 18.0, + EnablePixelSizeControl = true, Unit = "pc" }, GUI = { diff --git a/data/assets/scene/digitaluniverse/exoplanets.asset b/data/assets/scene/digitaluniverse/exoplanets.asset index d85a85779e..cd1d29aae3 100644 --- a/data/assets/scene/digitaluniverse/exoplanets.asset +++ b/data/assets/scene/digitaluniverse/exoplanets.asset @@ -22,19 +22,21 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 1.0, 1.0 }, - Transparency = 0.65, + Opacity = 1.0, ScaleFactor = 10.0, Texture = textures .. "/target-blue.png", File = speck .. "/expl.speck", LabelFile = speck .. "/expl.label", - ScaleFactor = 380.0, + ScaleFactor = 392.5, TextColor = { 0.3, 0.3, 0.8, 1.0 }, TextSize = 14.8, TextMaxSize = 200.0, TextMinSize = 10.0, CorrectionSizeEndDistance = 15.23, CorrectionSizeFactor = 13.3, - Unit = "pc" + Unit = "pc", + BillboardMaxSize = 52.0, + EnablePixelSizeControl = true, }, GUI = { Path = "/Milky Way/Exoplanets" diff --git a/data/assets/scene/digitaluniverse/globularclusters.asset b/data/assets/scene/digitaluniverse/globularclusters.asset index b029c5237d..2bce90db9e 100644 --- a/data/assets/scene/digitaluniverse/globularclusters.asset +++ b/data/assets/scene/digitaluniverse/globularclusters.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Globular Clusters Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_globularclusters_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,17 +22,19 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 0.8, 0.8, 0.0 }, - Transparency = 0.35, + Opacity = 1.0, File = speck .. "/gc.speck", Texture = textures .. "/point4.png", PolygonSides = 5, LabelFile = speck .. "/gc.label", TextColor = { 0.5, 0.5, 0.0, 1.0 }, ScaleFactor = 440.0, - TextSize = 17.5, + TextSize = 18.6, TextMinSize = 10.0, - TextMaxSize = 30.0, - Unit = "pc" + TextMaxSize = 14.4, + Unit = "pc", + BillboardMaxSize = 13.5, + EnablePixelSizeControl = true, }, GUI = { Name = "Globular Clusters", diff --git a/data/assets/scene/digitaluniverse/grids.asset b/data/assets/scene/digitaluniverse/grids.asset index ff9eb64c64..cb17a78754 100644 --- a/data/assets/scene/digitaluniverse/grids.asset +++ b/data/assets/scene/digitaluniverse/grids.asset @@ -24,7 +24,7 @@ local radio = { Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - GridColor = { 1.0, 1.0, 0.3, 0.75}, + GridColor = { 0.3, 0.84, 1.0, 0.3}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, -0.9938214 , -0.1109906, -0.0003515167, 0.0, @@ -74,7 +74,7 @@ local ecliptic = { Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - GridColor = { 0.7, 0.0, 0.0, 0.5}, + GridColor = { 0.74, 0.26, 0.26, 0.5}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, -0.9938214 , -0.1109906, -0.0003515167, 0.0, @@ -121,13 +121,13 @@ local equatorial = { Transform = { Scale = { Type = "StaticScale", - Scale = 6.2440846E17; + Scale = 4.28601E17; } }, Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - GridColor = { 0.0, 0.0, 1.0, 0.8}, + GridColor = { 0.69, 0.68, 0.29, 0.8}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661, 0.0, -0.8734371 , -0.4448296, -0.1980764, 0.0, diff --git a/data/assets/scene/digitaluniverse/groups.asset b/data/assets/scene/digitaluniverse/groups.asset index 95e63c03d0..745f054baf 100644 --- a/data/assets/scene/digitaluniverse/groups.asset +++ b/data/assets/scene/digitaluniverse/groups.asset @@ -15,16 +15,23 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 1.0, 1.0 }, - Transparency = 0.65, + Opacity = 0.65, --ScaleFactor = 10.0, LabelFile = speck .. "/groups.label", TextColor = { 0.1, 0.6, 0.2, 1.0 }, TextSize = 21.5, TextMinSize = 8.0, - Unit = "Mpc" + Unit = "Mpc", + DrawLabels = true, + TransformationMatrix = { + -0.7357425748, 0.67726129641, 0.0, 0.0, + -0.074553778365, -0.080991471307, 0.9939225904, 0.0, + 0.67314530211, 0.73127116582, 0.11008126223, 0.0, + 0.0, 0.0, 0.0, 1.0 + }, }, GUI = { - Name = "Nearby Galaxy Groups", + Name = "Galaxy Group Labels", Path = "/Universe/Galaxies" } } diff --git a/data/assets/scene/digitaluniverse/h2regions.asset b/data/assets/scene/digitaluniverse/h2regions.asset index dd77eab63e..51058458ce 100644 --- a/data/assets/scene/digitaluniverse/h2regions.asset +++ b/data/assets/scene/digitaluniverse/h2regions.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "HII Regions Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_h2regions_speck", - Version = 2 + Version = 3 }) local object = { @@ -22,17 +22,19 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 0.0, 0.5, 1.0 }, - Transparency = 0.35, + Opacity = 1.0, File = speck .. "/h2.speck", Texture = textures .."/point4.png", PolygonSides = 6, LabelFile = speck .. "/h2.label", TextColor = { 0.5, 0.5, 0.5, 1.0 }, - ScaleFactor = 420, + ScaleFactor = 425, TextSize = 17.25, TextMinSize = 10.0, TextMinSize = 30.0, - Unit = "pc" + Unit = "pc", + BillboardMaxSize = 25.0, + EnablePixelSizeControl = true }, GUI = { Name = "HII Regions", diff --git a/data/assets/scene/digitaluniverse/kepler.asset b/data/assets/scene/digitaluniverse/kepler.asset index e541ec7a87..75e102fe89 100644 --- a/data/assets/scene/digitaluniverse/kepler.asset +++ b/data/assets/scene/digitaluniverse/kepler.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Kepler Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_kepler_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,13 +22,15 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 1.0, 0.0 }, - Transparency = 0.99, - ScaleFactor = 395.0, + Opacity = 0.99, + ScaleFactor = 410.0, File = speck .. "/kepler.speck", Texture = textures .. "/halo.png", CorrectionSizeEndDistance = 15.86, CorrectionSizeFactor = 8.59, - Unit = "pc" + Unit = "pc", + BillboardMaxSize = 23.0, + EnablePixelSizeControl = true }, GUI = { Name = "Kepler Planetary Candidates", diff --git a/data/assets/scene/digitaluniverse/localdwarfs.asset b/data/assets/scene/digitaluniverse/localdwarfs.asset index b31b13d09e..bd9c6ccfd7 100644 --- a/data/assets/scene/digitaluniverse/localdwarfs.asset +++ b/data/assets/scene/digitaluniverse/localdwarfs.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Local Dwarfs Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_localdwarfs_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,19 +22,23 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 0.5, 1.0, 0.2 }, - Transparency = 0.3, - File = speck .. "/localdwarfs.speck", + ColorMap = speck .. "/localgroup.cmap", + ColorOption = { "association" }, + Opacity = 0.3, + File = speck .. "/localgroup.speck", Texture = textures .. "/point4.png", PolygonSides = 12, - LabelFile = speck .. "/localdwarfs.label", + LabelFile = speck .. "/localgroup.label", TextColor = { 0.3, 0.3, 1.0, 1.0 }, - ScaleFactor = 478, + ScaleFactor = 465, TextSize = 18.3, TextMinSize = 7.3, - Unit = "Mpc" + Unit = "Mpc", + BillboardMaxSize = 20.0, + EnablePixelSizeControl = true }, GUI = { - Name = "Local Dwarf Galaxies", + Name = "Local Group", Path = "/Universe/Galaxies" } } diff --git a/data/assets/scene/digitaluniverse/milkyway.asset b/data/assets/scene/digitaluniverse/milkyway.asset index ad2453fd20..4c0f5eb010 100644 --- a/data/assets/scene/digitaluniverse/milkyway.asset +++ b/data/assets/scene/digitaluniverse/milkyway.asset @@ -23,6 +23,13 @@ local planeSpeck = asset.syncedResource({ Version = 1 }) +local homespeck = asset.syncedResource({ + Name = "Home Speck File", + Type = "HttpSynchronization", + Identifier = "digitaluniverse_home_speck", + Version = 1 +}) + local sphere = { Identifier = "MilkyWay", Transform = { @@ -40,7 +47,7 @@ local sphere = { Orientation = "Inside", UseAdditiveBlending = true, MirrorTexture = true, - FadeOutThreshold = 0.025, + FadeOutThreshold = 0.0015, Background = true }, GUI = { @@ -73,6 +80,43 @@ local plane = { } } +local homeLabel = { + Identifier = "HomeLabel", + Renderable = { + Type = "RenderableBillboardsCloud", + Enabled = false, + Color = { 1.0, 0.4, 0.2 }, + Opacity = 0.99, + ScaleFactor = 500.0, + --File = homespeck .. "/home.speck", + -- Texture = textures .. "/point3.png", + DrawLabels = true, + LabelFile = homespeck .. "/home.label", + TextColor = { 0.8, 0.8, 0.8, 1.0 }, + TextSize = 20.50, + TextMinSize = 16.0, + TransformationMatrix = { + -0.7357425748, 0.67726129641, 0.0, 0.0, + -0.074553778365, -0.080991471307, 0.9939225904, 0.0, + 0.67314530211, 0.73127116582, 0.11008126223, 0.0, + 0.0, 0.0, 0.0, 1.0 + }, + Unit = "Mpc", + -- Fade in value in the same unit as "Unit" + FadeInDistances = { 0.05, 1.0 }, + -- Max size in pixels + BillboardMaxSize = 8.22, + BillboardMinSize = 0.0, + --CorrectionSizeEndDistance = 22.0, + --CorrectionSizeFactor = 10.45 + EnablePixelSizeControl = true + }, + GUI = { + Name = "Home Label", + Path = "/Universe/Galaxies" + } +} -assetHelper.registerSceneGraphNodesAndExport(asset, { sphere, plane }) + +assetHelper.registerSceneGraphNodesAndExport(asset, { sphere, plane, homeLabel }) diff --git a/data/assets/scene/digitaluniverse/obassociations.asset b/data/assets/scene/digitaluniverse/obassociations.asset index 3b5d9e2355..3c68412009 100644 --- a/data/assets/scene/digitaluniverse/obassociations.asset +++ b/data/assets/scene/digitaluniverse/obassociations.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "OB Associations Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_obassociations_speck", - Version = 2 + Version = 3 }) local object = { @@ -21,18 +21,24 @@ local object = { Renderable = { Type = "RenderableBillboardsCloud", Enabled = false, - Color = { 0.0, 0.0, 1.0 }, - Transparency = 0.5, + Color = { 1.0, 1.0, 1.0 }, + ColorMap = speck .. "/ob.cmap", + ColorOption = { "arm" }, + SizeOption = {"diameter"}, + ExactColorMap = true, + Opacity = 0.9, File = speck .. "/ob.speck", Texture = textures .. "/point4.png", PolygonSides = 7, LabelFile = speck .. "/ob.label", TextColor = { 0.4, 0.5, 1.0, 1.0 }, - ScaleFactor = 428.0, + ScaleFactor = 390.0, TextSize = 17.0, TextMinSize = 5.76, TextMaxSize = 30.0, - Unit = "pc" + Unit = "pc", + --BillboardMaxSize = 21.0, + EnablePixelSizeControl = true }, GUI = { Name = "OB Associations", diff --git a/data/assets/scene/digitaluniverse/openclusters.asset b/data/assets/scene/digitaluniverse/openclusters.asset index 2fde394eda..a99e330901 100644 --- a/data/assets/scene/digitaluniverse/openclusters.asset +++ b/data/assets/scene/digitaluniverse/openclusters.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Open Clusters Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_openclusters_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,7 +22,7 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 0.1, 0.8, 0.4 }, - Transparency = 0.5, + Opacity = 0.5, File = speck .. "/oc.speck", Texture = textures .. "/point4.png", PolygonSides = 12, @@ -32,7 +32,9 @@ local object = { TextSize = 16.68, TextMinSize = 4.5, TextMaxSize = 30.0, - Unit = "pc" + Unit = "pc", + BillboardMaxSize = 20.22, + EnablePixelSizeControl = true }, GUI = { Name = "Open Star Clusters", diff --git a/data/assets/scene/digitaluniverse/planetarynebulae.asset b/data/assets/scene/digitaluniverse/planetarynebulae.asset index ec5e04ab05..8bb3fab173 100644 --- a/data/assets/scene/digitaluniverse/planetarynebulae.asset +++ b/data/assets/scene/digitaluniverse/planetarynebulae.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Planetary Nebulae Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_planetarynebulae_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,17 +22,19 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 0.4, 0.4, 0.9 }, - Transparency = 0.35, + Opacity = 1.0, File = speck .. "/pn.speck", Texture = textures .. "/point4.png", PolygonSides = 3, LabelFile = speck .. "/pn.label", TextColor = { 0.25, 0.25, 0.65, 1.0 }, - ScaleFactor = 418.33, + ScaleFactor = 435.0, TextSize = 16.68, TextMinSize = 4.5, TextMaxSize = 30.0, - Unit = "pc" + Unit = "pc", + BillboardMaxSize = 35, + EnablePixelSizeControl = true }, GUI = { Name = "Planetary Nebulae", diff --git a/data/assets/scene/digitaluniverse/pulsars.asset b/data/assets/scene/digitaluniverse/pulsars.asset index 35c3f376c8..4b490fd077 100644 --- a/data/assets/scene/digitaluniverse/pulsars.asset +++ b/data/assets/scene/digitaluniverse/pulsars.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Pulsars Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_pulsars_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,7 +22,7 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 0.7, 0.0, 0.0 }, - Transparency = 0.5, + Opacity = 1.0, File = speck .. "/pulsar.speck", Texture = textures .. "/point4.png", PolygonSides = 4, @@ -32,7 +32,9 @@ local object = { TextSize = 16.68, TextMinSize = 7.5, TextMaxSize = 30.0, - Unit = "pc" + Unit = "pc", + BillboardMaxSize = 35, + EnablePixelSizeControl = true }, GUI = { Path = "/Milky Way" diff --git a/data/assets/scene/digitaluniverse/quasars.asset b/data/assets/scene/digitaluniverse/quasars.asset index beeff0ac60..b24f034f7d 100644 --- a/data/assets/scene/digitaluniverse/quasars.asset +++ b/data/assets/scene/digitaluniverse/quasars.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Quasars Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_quasars_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,15 +22,17 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = true, Color = { 1.0, 0.4, 0.2 }, - Transparency = 1.0, + Opacity = 0.95, File = speck .. "/quasars.speck", Texture = textures .. "/point3.png", Unit = "Mpc", - ScaleFactor = 537.31, + ScaleFactor = 540.9, -- Fade in value in the same unit as "Unit" FadeInDistances = { 1000.0, 10000.0 }, BillboardMaxSize = 30.0, BillboardMinSize = 0.0, + BillboardMaxSize = 11.1, + EnablePixelSizeControl = true }, GUI = { Path = "/Universe" diff --git a/data/assets/scene/digitaluniverse/sdss.asset b/data/assets/scene/digitaluniverse/sdss.asset index bdd2ae2d49..38563ed859 100644 --- a/data/assets/scene/digitaluniverse/sdss.asset +++ b/data/assets/scene/digitaluniverse/sdss.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Sloan Digital Sky Survey Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_sloandss_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,11 +22,11 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = true, Color = { 0.8, 0.8, 1.0 }, - Transparency = 1.0, - ScaleFactor = 507.88, + Opacity = 0.8, + ScaleFactor = 520.0, File = speck .. "/SDSSgals.speck", - ColorMap = speck .. "/lss.cmap", - ColorOption = { "redshift", "prox5Mpc" }, + ColorMap = speck .. "/SDSSgals.cmap", + ColorOption = { "redshift", "proximity" }, ColorRange = { { 0.0, 0.075 }, { 1.0, 50.0 } }, Texture = textures .. "/point3.png", Unit = "Mpc", @@ -38,7 +38,9 @@ local object = { CorrectionSizeFactor = 10.41, TextSize = 14.8, TextMinSize = 10.0, - TextMaxSize = 50.0 + TextMaxSize = 50.0, + BillboardMaxSize = 5.5, + EnablePixelSizeControl = true }, GUI = { Name = "Sloan Digital Sky Survey", diff --git a/data/assets/scene/digitaluniverse/starlabels.asset b/data/assets/scene/digitaluniverse/starlabels.asset index 14a536635d..5576bb4a9f 100644 --- a/data/assets/scene/digitaluniverse/starlabels.asset +++ b/data/assets/scene/digitaluniverse/starlabels.asset @@ -15,7 +15,7 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 1.0, 1.0 }, - Transparency = 0.65, + Opacity = 0.65, LabelFile = speck .. "/stars.label", TextColor = { 0.4, 0.4, 0.4, 1.0 }, DrawLabels = true, diff --git a/data/assets/scene/digitaluniverse/starorbits.asset b/data/assets/scene/digitaluniverse/starorbits.asset new file mode 100644 index 0000000000..2b07b5a6f1 --- /dev/null +++ b/data/assets/scene/digitaluniverse/starorbits.asset @@ -0,0 +1,184 @@ +local assetHelper = asset.require('util/asset_helper') +local transforms = asset.require('scene/solarsystem/sun/transforms') +local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms') + + +local speck = asset.syncedResource({ + Name = "Grids Speck Files", + Type = "HttpSynchronization", + Identifier = "digitaluniverse_starorbits_speck", + Version = 1 +}) + +local sunOrbit = { + Identifier = "SunOrbit", + --Parent = transforms.SolarSystemBarycenter.Name, + Renderable = { + Type = "RenderableDUMeshes", + Enabled = false, + Color = { 1.0, 0.65, 0.0 }, + Transparency = 1.0, + ScaleFactor = 1.0, + File = speck .. "/starorbits-Sun.speck", + MeshColor = {{ 1.0, 0.65, 0.0 }}, + --LabelFile = speck .. "/1ld.label", + TextColor = { 0.0, 0.2, 0.5, 1.0 }, + TextSize = 10.3, + TextMinSize = 0.5, + TextMaxSize = 30.0, + Unit = "pc" + }, + GUI = { + Name = "Sun Orbit", + Path = "/Milky Way/Stars/Stars Orbits" + } +} + +local barnardsOrbit = { + Identifier = "BarnardsOrbit", + --Parent = transforms.SolarSystemBarycenter.Name, + Renderable = { + Type = "RenderableDUMeshes", + Enabled = false, + Color = {1.0, 1.0, 1.0}, + Transparency = 1.0, + ScaleFactor = 1.0, + File = speck .. "/starorbits-BarnardsStar.speck", + MeshColor = {{0.39, 0.58, 0.93}}, + --LabelFile = speck .. "/1ld.label", + TextColor = { 0.0, 0.2, 0.5, 1.0 }, + TextSize = 10.3, + TextMinSize = 0.5, + TextMaxSize = 30.0, + Unit = "pc" + }, + GUI = { + Name = "Barnards Orbit", + Path = "/Milky Way/Stars/Stars Orbits" + } +} + +local kapteynsOrbit = { + Identifier = "KapteynsOrbit", + --Parent = transforms.SolarSystemBarycenter.Name, + Renderable = { + Type = "RenderableDUMeshes", + Enabled = false, + Color = {1.0, 1.0, 1.0}, + Transparency = 1.0, + ScaleFactor = 1.0, + File = speck .. "/starorbits-kapteynsStar.speck", + MeshColor = {{0.6, 0.6, 0.6}}, + --LabelFile = speck .. "/1ld.label", + TextColor = { 0.0, 0.2, 0.5, 1.0 }, + TextSize = 10.3, + TextMinSize = 0.5, + TextMaxSize = 30.0, + Unit = "pc" + }, + GUI = { + Name = "Kapteyns Orbit", + Path = "/Milky Way/Stars/Stars Orbits" + } +} + +local lacaille9352Orbit = { + Identifier = "Lacaille9352Orbit", + --Parent = transforms.SolarSystemBarycenter.Name, + Renderable = { + Type = "RenderableDUMeshes", + Enabled = false, + Color = {1.0, 1.0, 1.0}, + Transparency = 1.0, + ScaleFactor = 1.0, + File = speck .. "/starorbits-Lacaille9352.speck", + MeshColor = {{0.58, 0.0, 0.83}}, + --LabelFile = speck .. "/1ld.label", + TextColor = { 0.0, 0.2, 0.5, 1.0 }, + TextSize = 10.3, + TextMinSize = 0.5, + TextMaxSize = 30.0, + Unit = "pc" + }, + GUI = { + Name = "Lacaille 9352 Orbit", + Path = "/Milky Way/Stars/Stars Orbits" + } +} + +local lSR1826Orbit = { + Identifier = "LSR1826Orbit", + --Parent = transforms.SolarSystemBarycenter.Name, + Renderable = { + Type = "RenderableDUMeshes", + Enabled = false, + Color = {1.0, 1.0, 1.0}, + Transparency = 1.0, + ScaleFactor = 1.0, + File = speck .. "/starorbits-LSR1826+3014.speck", + MeshColor = {{0.0, 0.39, 0.0}}, + --LabelFile = speck .. "/1ld.label", + TextColor = { 0.0, 0.2, 0.5, 1.0 }, + TextSize = 10.3, + TextMinSize = 0.5, + TextMaxSize = 30.0, + Unit = "pc" + }, + GUI = { + Name = "LSR1826+3014 Orbit", + Path = "/Milky Way/Stars/Stars Orbits" + } +} + +local lSRJ0822Orbit = { + Identifier = "LSRJ0822Orbit", + --Parent = transforms.SolarSystemBarycenter.Name, + Renderable = { + Type = "RenderableDUMeshes", + Enabled = false, + Color = {1.0, 1.0, 1.0}, + Transparency = 1.0, + ScaleFactor = 1.0, + File = speck .. "/starorbits-LSRJ0822+1700.speck", + MeshColor = {{0.5, 1.0, 0.0}}, + --LabelFile = speck .. "/1ld.label", + TextColor = { 0.0, 0.2, 0.5, 1.0 }, + TextSize = 10.3, + TextMinSize = 0.5, + TextMaxSize = 30.0, + Unit = "pc" + }, + GUI = { + Name = "LSRJ0822+1700 Orbit", + Path = "/Milky Way/Stars/Stars Orbits" + } +} + +local pM_J13420Orbit = { + Identifier = "PM_J13420Orbit", + --Parent = transforms.SolarSystemBarycenter.Name, + Renderable = { + Type = "RenderableDUMeshes", + Enabled = false, + Color = {1.0, 1.0, 1.0}, + Transparency = 1.0, + ScaleFactor = 1.0, + File = speck .. "/starorbits-PM_J13420-3415.speck", + MeshColor = {{0.70, 0.13, 0.13}}, + --LabelFile = speck .. "/1ld.label", + TextColor = { 0.0, 0.2, 0.5, 1.0 }, + TextSize = 10.3, + TextMinSize = 0.5, + TextMaxSize = 30.0, + Unit = "pc" + }, + GUI = { + Name = "PM_J13420-3415 Orbit", + Path = "/Milky Way/Stars/Stars Orbits" + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { + sunOrbit, barnardsOrbit, pM_J13420Orbit, lSRJ0822Orbit, lSR1826Orbit, + lacaille9352Orbit, kapteynsOrbit +}) diff --git a/data/assets/scene/digitaluniverse/stars.asset b/data/assets/scene/digitaluniverse/stars.asset index c33d89648d..696c4aa739 100644 --- a/data/assets/scene/digitaluniverse/stars.asset +++ b/data/assets/scene/digitaluniverse/stars.asset @@ -13,7 +13,14 @@ local speck = asset.syncedResource({ Name = "Stars Speck Files", Type = "HttpSynchronization", Identifier = "stars_du", - Version = 3 + Version = 4 +}) + +local sunspeck = asset.syncedResource({ + Name = "Stars Speck Files", + Type = "HttpSynchronization", + Identifier = "digitaluniverse_sunstar_speck", + Version = 1 }) local colorLUT = asset.syncedResource({ @@ -40,4 +47,23 @@ local stars = { } } -assetHelper.registerSceneGraphNodesAndExport(asset, { stars }) +local sunstar = { + Identifier = "SunStar", + Renderable = { + Type = "RenderableStars", + File = sunspeck .. "/sunstar.speck", + Texture = textures .. "/halo.png", + --ShapeTexture = textures .. "/disc.png", + ColorMap = colorLUT .. "/colorbv.cmap", + MagnitudeExponent = 6.2, + SizeComposition = "Distance Modulus", + RenderMethod = "Texture Based", -- or PSF + FadeInDistances = {0.0001, 0.1} + }, + GUI = { + Name = "Sun", + Path = "/Milky Way/Stars" + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { stars, sunstar }) diff --git a/data/assets/scene/digitaluniverse/superclusters.asset b/data/assets/scene/digitaluniverse/superclusters.asset index cd8afe87fd..d51868d921 100644 --- a/data/assets/scene/digitaluniverse/superclusters.asset +++ b/data/assets/scene/digitaluniverse/superclusters.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Galaxy Superclusters Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_superclusters_speck", - Version = 1 + Version = 2 }) local object = { @@ -21,16 +21,20 @@ local object = { Renderable = { Type = "RenderableBillboardsCloud", Enabled = false, + DrawElements = false, Color = { 1.0, 1.0, 1.0 }, - Transparency = 0.65, + Opacity = 0.65, File = speck .. "/superclust.speck", Texture = textures .. "/point3.png", LabelFile = speck .. "/superclust.label", - TextColor = { 0.6, 0.6, 0.6, 1.0 }, + TextColor = { 0.9, 0.9, 0.9, 1.0 }, ScaleFactor = 531.0, TextSize = 22.44, TextMinSize = 8.0, - Unit = "Mpc" + Unit = "Mpc", + DrawLabels = true, + --BillboardMaxSize = 7.2, + EnablePixelSizeControl = true }, GUI = { Name = "Galaxy Superclusters", diff --git a/data/assets/scene/digitaluniverse/supernovaremnants.asset b/data/assets/scene/digitaluniverse/supernovaremnants.asset index 4254f908f9..3f68374122 100644 --- a/data/assets/scene/digitaluniverse/supernovaremnants.asset +++ b/data/assets/scene/digitaluniverse/supernovaremnants.asset @@ -13,7 +13,7 @@ local speck = asset.syncedResource({ Name = "Supernova Remnants Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_supernovaremnants_speck", - Version = 1 + Version = 2 }) local object = { @@ -22,19 +22,21 @@ local object = { Type = "RenderableBillboardsCloud", Enabled = false, Color = { 1.0, 0.5, 0.0 }, - Transparency = 0.5, + Opacity = 0.9, File = speck .. "/snr.speck", Texture = textures .. "/point4.png", PolygonSides = 7, LabelFile = speck .. "/snr.label", TextColor = { 0.6, 0.3, 0.0, 1.0 }, - ScaleFactor = 440.08, + ScaleFactor = 435, TextSize = 17.5, TextMinSize = 8.0, TextMaxSize = 30.0, - CorrectionSizeEndDistance = 17.5, - CorrectionSizeFactor = 13.96, - Unit = "pc" + --CorrectionSizeEndDistance = 17.5, + --CorrectionSizeFactor = 13.96, + Unit = "pc", + BillboardMaxSize = 27.2, + EnablePixelSizeControl = true }, GUI = { Name = "Supernova Remnants", diff --git a/data/assets/scene/digitaluniverse/tully.asset b/data/assets/scene/digitaluniverse/tully.asset index c1d692e22f..59d750c728 100644 --- a/data/assets/scene/digitaluniverse/tully.asset +++ b/data/assets/scene/digitaluniverse/tully.asset @@ -22,13 +22,15 @@ local tullyPoints = { Type = "RenderableBillboardsCloud", Enabled = true, Color = { 1.0, 0.4, 0.2 }, - Transparency = 0.99, - ScaleFactor = 502.77, + Opacity = 0.99, + ScaleFactor = 500.0, File = speck .. "/tully.speck", Texture = textures .. "/point3.png", + --ColorMap = speck .. "/tully.cmap", ColorMap = speck .. "/lss.cmap", + --ColorOption = { "proximity" }, ColorOption = { "prox5Mpc" }, - ColorRange = { { 1.0, 80.0 } }, + ColorRange = { { 1.0, 30.0 } }, LabelFile = speck .. "/tully.label", TextColor = { 0.7, 0.7, 0.7, 1.0 }, TextSize = 20.50, @@ -43,10 +45,11 @@ local tullyPoints = { -- Fade in value in the same unit as "Unit" FadeInDistances = { 0.05, 1.0 }, -- Max size in pixels - BillboardMaxSize = 50.0, + BillboardMaxSize = 8.22, BillboardMinSize = 0.0, - CorrectionSizeEndDistance = 22.0, - CorrectionSizeFactor = 10.45 + --CorrectionSizeEndDistance = 22.0, + --CorrectionSizeFactor = 10.45 + EnablePixelSizeControl = true }, GUI = { Name = "Tully Galaxies", @@ -74,7 +77,7 @@ local tullyImages = { }, Unit = "Mpc", -- Fade in value in the same unit as "Unit" - FadeInDistances = {0.05, 0.1}, + FadeInDistances = {0.001, 0.05010}, PlaneMinSize = 5.0 }, GUI = { @@ -84,5 +87,4 @@ local tullyImages = { } - assetHelper.registerSceneGraphNodesAndExport(asset, { tullyPoints, tullyImages }) diff --git a/data/assets/scene/digitaluniverse/voids.asset b/data/assets/scene/digitaluniverse/voids.asset index c6684a28c8..64ca8bb4ad 100644 --- a/data/assets/scene/digitaluniverse/voids.asset +++ b/data/assets/scene/digitaluniverse/voids.asset @@ -6,7 +6,7 @@ local speck = asset.syncedResource({ Name = "Voids Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_voids_speck", - Version = 1 + Version = 2 }) local object = { @@ -14,11 +14,12 @@ local object = { Renderable = { Type = "RenderableBillboardsCloud", Enabled = false, + DrawElements = false, DrawLabels = true, Color = { 1.0, 1.0, 1.0 }, - Transparency = 0.65, + Opacity = 0.65, LabelFile = speck .. "/voids.label", - TextColor = { 0.0, 0.4, 0.7, 1.0 }, + TextColor = { 0.296, 0.629, 1.0, 1.0 }, TextSize = 20.9, TextMinSize = 8.0, Unit = "Mpc" diff --git a/data/assets/scene/solarsystem/planets/earth/moon/moon.asset b/data/assets/scene/solarsystem/planets/earth/moon/moon.asset index 7be045842c..0b76a74a74 100644 --- a/data/assets/scene/solarsystem/planets/earth/moon/moon.asset +++ b/data/assets/scene/solarsystem/planets/earth/moon/moon.asset @@ -61,7 +61,7 @@ local Moon = { Name = "Uvvis Hybrid [Utah]", FilePath = mapServiceConfigs .. "/Utah/UvvisHybrid.wms", Settings = { - Gamma = 0.75 + Gamma = 0.75, Multiplier = 1.5 } }, @@ -70,7 +70,7 @@ local Moon = { Name = "Uvvis Hybrid [Sweden]", FilePath = mapServiceConfigs .. "/LiU/Uvvis_Hybrid.wms", Settings = { - Gamma = 0.75 + Gamma = 0.75, Multiplier = 1.5 } }, diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp index c29d1608a9..da42b36210 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp @@ -56,12 +56,12 @@ namespace { constexpr const char* ProgramObjectName = "RenderableBillboardsCloud"; constexpr const char* RenderToPolygonProgram = "RenderableBillboardsCloud_Polygon"; - constexpr const std::array UniformNames = { + constexpr const std::array UniformNames = { "cameraViewProjectionMatrix", "modelMatrix", "cameraPosition", "cameraLookUp", "renderOption", "minBillboardSize", "maxBillboardSize", "correctionSizeEndDistance", "correctionSizeFactor", "color", "alphaValue", "scaleFactor", "up", "right", "fadeInValue", "screenSize", "spriteTexture", - "hasColorMap", "enabledRectSizeControl" + "hasColorMap", "enabledRectSizeControl", "hasDvarScaling" }; constexpr const char* KeyFile = "File"; @@ -106,6 +106,20 @@ namespace { "The path to the color map file of the astronomical object." }; + constexpr openspace::properties::Property::PropertyInfo ExactColorMapInfo = { + "ExactColorMap", + "Exact Color Map File", + "Set a 1 to 1 relationship between the color index variable and the colormap" + " entrered value." + }; + + constexpr openspace::properties::Property::PropertyInfo ColorRangeInfo = { + "ColorRange", + "Color Range", + "This value determines the colormap ranges for the color parameters of the " + "astronomical objects." + }; + constexpr openspace::properties::Property::PropertyInfo PolygonSidesInfo = { "PolygonSides", "Polygon Sides", @@ -160,15 +174,15 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ColorOptionInfo = { "ColorOption", "Color Option", - "This value determines which paramenter is used default color of the " + "This value determines which paramenter is used for default color of the " "astronomical objects." }; - constexpr openspace::properties::Property::PropertyInfo ColorRangeInfo = { - "ColorRange", - "Color Range", - "This value determines the color ranges for the color parameter of the " - "astronomical objects." + constexpr openspace::properties::Property::PropertyInfo SizeOptionInfo = { + "SizeOption", + "Size Option Variable", + "This value determines which paramenter (datavar) is used for scaling " + "of the astronomical objects." }; constexpr openspace::properties::Property::PropertyInfo TransformationMatrixInfo = { @@ -275,6 +289,12 @@ documentation::Documentation RenderableBillboardsCloud::Documentation() { Optional::Yes, ColorMapInfo.description }, + { + ExactColorMapInfo.identifier, + new BoolVerifier, + Optional::Yes, + ExactColorMapInfo.description + }, { PolygonSidesInfo.identifier, new IntVerifier, @@ -323,6 +343,12 @@ documentation::Documentation RenderableBillboardsCloud::Documentation() { Optional::Yes, ColorOptionInfo.description }, + { + SizeOptionInfo.identifier, + new StringListVerifier, + Optional::Yes, + SizeOptionInfo.description + }, { ColorRangeInfo.identifier, new Vector2ListVerifier, @@ -384,12 +410,7 @@ documentation::Documentation RenderableBillboardsCloud::Documentation() { RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 600.f) - , _pointColor( - ColorInfo, - glm::vec3(1.f, 0.4f, 0.2f), - glm::vec3(0.f, 0.f, 0.f), - glm::vec3(1.0f, 1.0f, 1.0f) - ) + , _pointColor(ColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f)) , _spriteTexturePath(SpriteTextureInfo) , _textColor( TextColorInfo, @@ -404,6 +425,7 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di , _drawLabels(DrawLabelInfo, false) , _pixelSizeControl(PixelSizeControlInfo, false) , _colorOption(ColorOptionInfo, properties::OptionProperty::DisplayType::Dropdown) + , _datavarSizeOption(SizeOptionInfo, properties::OptionProperty::DisplayType::Dropdown) , _fadeInDistance( FadeInDistancesInfo, glm::vec2(0.f), @@ -426,10 +448,15 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di if (dictionary.hasKey(KeyFile)) { _speckFile = absPath(dictionary.value(KeyFile)); _hasSpeckFile = true; - _drawElements.onChange([&]() { _hasSpeckFile = !_hasSpeckFile; }); - addProperty(_drawElements); } + if (dictionary.hasKey(DrawElementsInfo.identifier)) { + _drawElements = dictionary.value(DrawElementsInfo.identifier); + } + + _drawElements.onChange([&]() { _hasSpeckFile = !_hasSpeckFile; }); + addProperty(_drawElements); + _renderOption.addOption(RenderOptionViewDirection, "Camera View Direction"); _renderOption.addOption(RenderOptionPositionNormal, "Camera Position Normal"); @@ -521,6 +548,10 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di ); } } + + if (dictionary.hasKey(ExactColorMapInfo.identifier)) { + _isColorMapExact = dictionary.value(ExactColorMapInfo.identifier); + } } else if (dictionary.hasKey(keyColor)) { _pointColor = dictionary.value(keyColor); @@ -537,6 +568,28 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di } addProperty(_scaleFactor); + if (dictionary.hasKey(SizeOptionInfo.identifier)) { + ghoul::Dictionary sizeOptionDataDic = dictionary.value( + SizeOptionInfo.identifier + ); + for (int i = 0; i < static_cast(sizeOptionDataDic.size()); ++i) { + std::string datavarSizeInUseName( + sizeOptionDataDic.value(std::to_string(i + 1)) + ); + _datavarSizeOption.addOption(i, datavarSizeInUseName); + _optionConversionSizeMap.insert({ i, datavarSizeInUseName }); + _datavarSizeOptionString = datavarSizeInUseName; + } + + _datavarSizeOption.onChange([&]() { + _dataIsDirty = true; + _datavarSizeOptionString = _optionConversionSizeMap[_datavarSizeOption.value()]; + }); + addProperty(_datavarSizeOption); + + _hasDatavarSize = true; + } + if (dictionary.hasKey(PolygonSidesInfo.identifier)) { _polygonSides = static_cast( dictionary.value(PolygonSidesInfo.identifier) @@ -617,13 +670,16 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di _correctionSizeFactor = static_cast( dictionary.value(CorrectionSizeFactorInfo.identifier) ); + + addProperty(_correctionSizeFactor); } - addProperty(_correctionSizeFactor); + if (dictionary.hasKey(PixelSizeControlInfo.identifier)) { _pixelSizeControl = dictionary.value(PixelSizeControlInfo.identifier); + addProperty(_pixelSizeControl); } - addProperty(_pixelSizeControl); + } bool RenderableBillboardsCloud::isReady() const { @@ -636,7 +692,7 @@ void RenderableBillboardsCloud::initialize() { throw ghoul::RuntimeError("Error loading data"); } - if (!_colorOptionString.empty()) { + if (!_colorOptionString.empty() && (_colorRangeData.size() > 1)) { // Following DU behavior here. The last colormap variable // entry is the one selected by default. _colorOption.setValue(static_cast(_colorRangeData.size() - 1)); @@ -783,6 +839,8 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data, _program->setUniform(_uniformCache.enabledRectSizeControl, _pixelSizeControl); + _program->setUniform(_uniformCache.hasDvarScaling, _hasDatavarSize); + GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); _program->setUniform(_uniformCache.screenSize, glm::vec2(viewport[2], viewport[3])); @@ -946,7 +1004,7 @@ void RenderableBillboardsCloud::render(const RenderData& data, RendererTasks&) { } glm::dvec3 orthoUp = glm::normalize(glm::cross(cameraViewDirectionWorld, orthoRight)); - if (_hasSpeckFile) { + if (_hasSpeckFile && _drawElements) { renderBillboards( data, modelMatrix, @@ -994,12 +1052,40 @@ void RenderableBillboardsCloud::update(const UpdateData&) { ); GLint positionAttrib = _program->attributeLocation("in_position"); - if (_hasColorMapFile) { - /*const size_t nAstronomicalObjects = _fullData.size() / - _nValuesPerAstronomicalObject; - const size_t nValues = _slicedData.size() / nAstronomicalObjects; - GLsizei stride = static_cast(sizeof(float) * nValues);*/ + if (_hasColorMapFile && _hasDatavarSize) { + glEnableVertexAttribArray(positionAttrib); + glVertexAttribPointer( + positionAttrib, + 4, + GL_FLOAT, + GL_FALSE, + sizeof(float) * 9, + nullptr + ); + GLint colorMapAttrib = _program->attributeLocation("in_colormap"); + glEnableVertexAttribArray(colorMapAttrib); + glVertexAttribPointer( + colorMapAttrib, + 4, + GL_FLOAT, + GL_FALSE, + sizeof(float) * 9, + reinterpret_cast(sizeof(float) * 4) + ); + + GLint dvarScalingAttrib = _program->attributeLocation("in_dvarScaling"); + glEnableVertexAttribArray(dvarScalingAttrib); + glVertexAttribPointer( + dvarScalingAttrib, + 1, + GL_FLOAT, + GL_FALSE, + sizeof(float) * 9, + reinterpret_cast(sizeof(float) * 8) + ); + } + else if (_hasColorMapFile) { glEnableVertexAttribArray(positionAttrib); glVertexAttribPointer( positionAttrib, @@ -1021,6 +1107,28 @@ void RenderableBillboardsCloud::update(const UpdateData&) { reinterpret_cast(sizeof(float) * 4) ); } + else if (_hasDatavarSize) { + glEnableVertexAttribArray(positionAttrib); + glVertexAttribPointer( + positionAttrib, + 4, + GL_FLOAT, + GL_FALSE, + sizeof(float) * 8, + nullptr + ); + + GLint dvarScalingAttrib = _program->attributeLocation("in_dvarScaling"); + glEnableVertexAttribArray(dvarScalingAttrib); + glVertexAttribPointer( + dvarScalingAttrib, + 1, + GL_FLOAT, + GL_FALSE, + sizeof(float) * 5, + reinterpret_cast(sizeof(float) * 4) + ); + } else { glEnableVertexAttribArray(positionAttrib); glVertexAttribPointer( @@ -1174,7 +1282,6 @@ bool RenderableBillboardsCloud::readSpeckFile() { // (signaled by the keywords 'datavar', 'texturevar', and 'texture') std::string line; while (true) { - std::streampos position = file.tellg(); std::getline(file, line); // Guard against wrong line endings (copying files from Windows to Mac) causes @@ -1193,9 +1300,7 @@ bool RenderableBillboardsCloud::readSpeckFile() { line.substr(0, 10) != "polyorivar" && line.substr(0, 10) != "maxcomment") { - // we read a line that doesn't belong to the header, so we have to jump back - // before the beginning of the current line - file.seekg(position); + // Started reading data break; } @@ -1222,11 +1327,9 @@ bool RenderableBillboardsCloud::readSpeckFile() { _nValuesPerAstronomicalObject += 3; // X Y Z are not counted in the Speck file indices + + do { - std::vector values(_nValuesPerAstronomicalObject); - - std::getline(file, line); - // Guard against wrong line endings (copying files from Windows to Mac) causes // lines to have a final \r if (!line.empty() && line.back() == '\r') { @@ -1234,16 +1337,25 @@ bool RenderableBillboardsCloud::readSpeckFile() { } if (line.empty()) { + std::getline(file, line); + continue; + } + else if (line[0] == '#') { + std::getline(file, line); continue; } std::stringstream str(line); + std::vector values(_nValuesPerAstronomicalObject); for (int i = 0; i < _nValuesPerAstronomicalObject; ++i) { str >> values[i]; } _fullData.insert(_fullData.end(), values.begin(), values.end()); + + // reads new line + std::getline(file, line); } while (!file.eof()); return true; @@ -1288,6 +1400,7 @@ bool RenderableBillboardsCloud::readColorMapFile() { std::stringstream str(line); glm::vec4 color; + // Each color in the colormap must be defined as (R,G,B,A) for (int j = 0; j < 4; ++j) { str >> color[j]; } @@ -1491,22 +1604,33 @@ void RenderableBillboardsCloud::createDataSlice() { _slicedData.reserve(4 * (_fullData.size() / _nValuesPerAstronomicalObject)); } - // Generate the color bins for the colomap - int colorMapInUse = 0; - std::vector colorBins; - if (_hasColorMapFile) { - colorMapInUse = _variableDataPositionMap[_colorOptionString]; - glm::vec2 currentColorRange = _colorRangeData[_colorOption.value()]; - float colorMapBinSize = (currentColorRange.y - currentColorRange.x) / - static_cast(_colorMapData.size()); - float bin = colorMapBinSize; - for (size_t i = 0; i < _colorMapData.size(); ++i) { - colorBins.push_back(bin); - bin += colorMapBinSize; + // what datavar in use for the index color + int colorMapInUse = _hasColorMapFile ? _variableDataPositionMap[_colorOptionString] : 0; + + // what datavar in use for the size scaling (if present) + int sizeScalingInUse = _hasDatavarSize ? + _variableDataPositionMap[_datavarSizeOptionString] : -1; + + auto addDatavarSizeScalling = [&](size_t i, int datavarInUse) { + _slicedData.push_back(_fullData[i + 3 + datavarInUse]); + }; + + auto addPosition = [&](const glm::vec4 &pos) { + for (int j = 0; j < 4; ++j) { + _slicedData.push_back(pos[j]); } + }; + + float minColorIdx = std::numeric_limits::max(); + float maxColorIdx = std::numeric_limits::min(); + + for (size_t i = 0; i < _fullData.size(); i += _nValuesPerAstronomicalObject) { + float colorIdx = _fullData[i + 3 + colorMapInUse]; + maxColorIdx = colorIdx >= maxColorIdx ? colorIdx : maxColorIdx; + minColorIdx = colorIdx < minColorIdx ? colorIdx : minColorIdx; } - float biggestCoord = -1.0f; + float biggestCoord = -1.f; for (size_t i = 0; i < _fullData.size(); i += _nValuesPerAstronomicalObject) { glm::dvec4 transformedPos = _transformationMatrix * glm::dvec4( _fullData[i + 0], @@ -1514,6 +1638,8 @@ void RenderableBillboardsCloud::createDataSlice() { _fullData[i + 2], 1.0 ); + // W-normalization + transformedPos /= transformedPos.w; glm::vec4 position(glm::vec3(transformedPos), static_cast(_unit)); if (_hasColorMapFile) { @@ -1521,29 +1647,49 @@ void RenderableBillboardsCloud::createDataSlice() { _slicedData.push_back(position[j]); biggestCoord = biggestCoord < position[j] ? position[j] : biggestCoord; } - // Finds from which bin to get the color. - // Note: the first color in the colormap file - // is the outliers color. - glm::vec4 itemColor; - float variableColor = _fullData[i + 3 + colorMapInUse]; - int c = static_cast(colorBins.size() - 1); - while (variableColor < colorBins[c]) { - --c; - if (c == 0) { - break; - } + + // Note: if exact colormap option is not selected, the first color and the + // last color in the colormap file are the outliers colors. + int variableColor = static_cast(_fullData[i + 3 + colorMapInUse]); + int colorIndex = 0; + + float cmax, cmin; + if (_colorRangeData.empty()) { + cmax = maxColorIdx; // Max value of datavar used for the index color + cmin = minColorIdx; // Min value of datavar used for the index color + } + else { + glm::vec2 currentColorRange = _colorRangeData[_colorOption.value()]; + cmax = currentColorRange.y; + cmin = currentColorRange.x; } - int colorIndex = c == static_cast(colorBins.size() - 1) ? 0 : c + 1; + if (_isColorMapExact) { + colorIndex = variableColor + cmin; + } + else { + float ncmap = static_cast(_colorMapData.size()); + float normalization = ((cmax != cmin) && (ncmap > 2)) ? + (ncmap - 2) / (cmax - cmin) : 0; + colorIndex = (variableColor - cmin) * normalization + 1; + colorIndex = colorIndex < 0 ? 0 : colorIndex; + colorIndex = colorIndex >= ncmap ? ncmap - 1 : colorIndex; + } for (int j = 0; j < 4; ++j) { _slicedData.push_back(_colorMapData[colorIndex][j]); } + + if (_hasDatavarSize) { + addDatavarSizeScalling(i, sizeScalingInUse); + } + } + else if (_hasDatavarSize) { + addDatavarSizeScalling(i, sizeScalingInUse); + addPosition(position); } else { - for (int j = 0; j < 4; ++j) { - _slicedData.push_back(position[j]); - } + addPosition(position); } } _fadeInDistance.setMaxValue(glm::vec2(10.0f * biggestCoord)); diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.h b/modules/digitaluniverse/rendering/renderablebillboardscloud.h index d0980ad486..aea5818783 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.h +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.h @@ -103,6 +103,8 @@ private: bool _hasSpriteTexture = false; bool _spriteTextureIsDirty = true; bool _hasColorMapFile = false; + bool _isColorMapExact = false; + bool _hasDatavarSize = false; bool _hasPolygon = false; bool _hasLabel = false; @@ -121,6 +123,7 @@ private: properties::BoolProperty _drawLabels; properties::BoolProperty _pixelSizeControl; properties::OptionProperty _colorOption; + properties::OptionProperty _datavarSizeOption; properties::Vec2Property _fadeInDistance; properties::BoolProperty _disableFadeInDistance; properties::FloatProperty _billboardMaxSize; @@ -139,24 +142,27 @@ private: UniformCache(cameraViewProjectionMatrix, modelMatrix, cameraPos, cameraLookup, renderOption, minBillboardSize, maxBillboardSize, correctionSizeEndDistance, correctionSizeFactor, color, alphaValue, scaleFactor, up, right, fadeInValue, - screenSize, spriteTexture, hasColormap, enabledRectSizeControl + screenSize, spriteTexture, hasColormap, enabledRectSizeControl, hasDvarScaling ) _uniformCache; + std::shared_ptr _font; std::string _speckFile; std::string _colorMapFile; std::string _labelFile; std::string _colorOptionString; + std::string _datavarSizeOptionString; Unit _unit = Parsec; std::vector _slicedData; std::vector _fullData; std::vector _colorMapData; + std::vector _colorRangeData; std::vector> _labelData; std::unordered_map _variableDataPositionMap; std::unordered_map _optionConversionMap; - std::vector _colorRangeData; + std::unordered_map _optionConversionSizeMap; int _nValuesPerAstronomicalObject = 0; diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.cpp b/modules/digitaluniverse/rendering/renderabledumeshes.cpp index 72ee2ebca1..f0e96c1bba 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.cpp +++ b/modules/digitaluniverse/rendering/renderabledumeshes.cpp @@ -164,7 +164,7 @@ documentation::Documentation RenderableDUMeshes::Documentation() { { keyColor, new Vector3Verifier, - Optional::No, + Optional::Yes, "Astronomical Object Color (r,g,b)." }, { @@ -715,8 +715,9 @@ bool RenderableDUMeshes::readSpeckFile() { //if (line.substr(0, 4) != "mesh") { // we read a line that doesn't belong to the header, so we have to jump back // before the beginning of the current line - file.seekg(position); - break; + //file.seekg(position); + //break; + continue; } else { //if (line.substr(0, 4) == "mesh") { diff --git a/modules/digitaluniverse/rendering/renderableplanescloud.cpp b/modules/digitaluniverse/rendering/renderableplanescloud.cpp index b06176406e..a86eac1e72 100644 --- a/modules/digitaluniverse/rendering/renderableplanescloud.cpp +++ b/modules/digitaluniverse/rendering/renderableplanescloud.cpp @@ -298,7 +298,7 @@ documentation::Documentation RenderablePlanesCloud::Documentation() { RenderablePlanesCloud::RenderablePlanesCloud(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _alphaValue(TransparencyInfo, 1.f, 0.f, 1.f) - , _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 50.f) + , _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 10000.f) , _textColor( TextColorInfo, glm::vec4(1.0f, 1.0, 1.0f, 1.f), @@ -598,6 +598,7 @@ void RenderablePlanesCloud::renderPlanes(const RenderData&, continue; } + // We only bind a new texture when it is needed if (currentTextureIndex != pAMapItem.first) { _textureMap[pAMapItem.first]->bind(); currentTextureIndex = pAMapItem.first; @@ -708,12 +709,14 @@ void RenderablePlanesCloud::render(const RenderData& data, RendererTasks&) { float fadeInVariable = 1.f; if (!_disableFadeInDistance) { - double distCamera = glm::length(data.camera.positionVec3()); + float distCamera = static_cast(glm::length(data.camera.positionVec3())); + distCamera /= scale; const glm::vec2 fadeRange = _fadeInDistance; - const float a = 1.0f / ((fadeRange.y - fadeRange.x) * scale); + //const float a = 1.f / ((fadeRange.y - fadeRange.x) * scale); + const float a = 1.f / ((fadeRange.y - fadeRange.x)); const float b = -(fadeRange.x / (fadeRange.y - fadeRange.x)); - const float funcValue = static_cast(a * distCamera + b); - fadeInVariable *= std::min(funcValue, 1.f); + const float funcValue = a * distCamera + b; + fadeInVariable *= funcValue > 1.f ? 1.f : funcValue; if (funcValue < 0.01f) { return; @@ -881,7 +884,6 @@ bool RenderablePlanesCloud::readSpeckFile() { // (signaled by the keywords 'datavar', 'texturevar', and 'texture') std::string line; while (true) { - std::streampos position = file.tellg(); std::getline(file, line); // Guard against wrong line endings (copying files from Windows to Mac) causes @@ -900,9 +902,7 @@ bool RenderablePlanesCloud::readSpeckFile() { line.substr(0, 10) != "polyorivar" && line.substr(0, 10) != "maxcomment") { - // we read a line that doesn't belong to the header, so we have to jump back - // before the beginning of the current line - file.seekg(position); + // Started reading data break; } @@ -993,9 +993,6 @@ bool RenderablePlanesCloud::readSpeckFile() { _nValuesPerAstronomicalObject += 3; // X Y Z are not counted in the Speck file indices do { - std::vector values(_nValuesPerAstronomicalObject); - - std::getline(file, line); // Guard against wrong line endings (copying files from Windows to Mac) causes // lines to have a final \r @@ -1004,6 +1001,11 @@ bool RenderablePlanesCloud::readSpeckFile() { } if (line.empty()) { + std::getline(file, line); + continue; + } + else if (line[0] == '#') { + std::getline(file, line); continue; } @@ -1013,6 +1015,8 @@ bool RenderablePlanesCloud::readSpeckFile() { glm::vec3 v(0.f); int textureIndex = 0; + std::vector values(_nValuesPerAstronomicalObject); + for (int i = 0; i < _nValuesPerAstronomicalObject; ++i) { str >> values[i]; if ((i >= _planeStartingIndexPos) && @@ -1046,6 +1050,9 @@ bool RenderablePlanesCloud::readSpeckFile() { } } _fullData.insert(_fullData.end(), values.begin(), values.end()); + + // reads new line + std::getline(file, line); } while (!file.eof()); return true; diff --git a/modules/digitaluniverse/shaders/billboard_fs.glsl b/modules/digitaluniverse/shaders/billboard_fs.glsl index 975f76a7be..3ca590e5a5 100644 --- a/modules/digitaluniverse/shaders/billboard_fs.glsl +++ b/modules/digitaluniverse/shaders/billboard_fs.glsl @@ -24,12 +24,12 @@ #include "fragment.glsl" -in vec4 gs_colorMap; +flat in vec4 gs_colorMap; in float vs_screenSpaceDepth; in vec2 texCoord; in float ta; -uniform float alphaValue; +uniform float alphaValue; // opacity uniform vec3 color; uniform sampler2D spriteTexture; uniform bool hasColorMap; @@ -64,6 +64,7 @@ Fragment getFragment() { // with the ATM. frag.gPosition = vec4(-1e32, -1e32, -1e32, 1.0); frag.gNormal = vec4(0.0, 0.0, 0.0, 1.0); + //frag.disableLDR2HDR = true; return frag; diff --git a/modules/digitaluniverse/shaders/billboard_gs.glsl b/modules/digitaluniverse/shaders/billboard_gs.glsl index 36a5dda0da..cb955fbc33 100644 --- a/modules/digitaluniverse/shaders/billboard_gs.glsl +++ b/modules/digitaluniverse/shaders/billboard_gs.glsl @@ -47,9 +47,13 @@ uniform float correctionSizeEndDistance; uniform bool enabledRectSizeControl; -in vec4 colorMap[]; +uniform bool hasDvarScaling; + +flat in vec4 colorMap[]; +flat in float dvarScaling[]; + +flat out vec4 gs_colorMap; -out vec4 gs_colorMap; out vec2 texCoord; out float vs_screenSpaceDepth; out float ta; @@ -65,11 +69,11 @@ const vec2 corners[4] = vec2[4]( void main() { - ta = 1.0f; - vec4 pos = gl_in[0].gl_Position; // in object space - gs_colorMap = colorMap[0]; - - double unit = PARSEC; + ta = 1.0f; + vec4 pos = gl_in[0].gl_Position; // in object space + gs_colorMap = colorMap[0]; + + double unit = PARSEC; // Must be the same as the enum in RenderableBillboardsCloud.h if (pos.w == 1.f) { @@ -91,8 +95,11 @@ void main() { dpos = modelMatrix * dpos; double scaleMultiply = exp(scaleFactor * 0.10); + scaleMultiply = hasDvarScaling ? dvarScaling[0] * scaleMultiply : scaleMultiply; + dvec3 scaledRight = dvec3(0.0); dvec3 scaledUp = dvec3(0.0); + vec4 initialPosition, secondPosition, thirdPosition, crossCorner; if (renderOption == 0) { @@ -139,11 +146,12 @@ void main() { scaledRight *= correctionScale; scaledUp *= correctionScale; - } else { + } else { + // linear alpha decay if (sizes.x < 2.0f * minBillboardSize) { float maxVar = 2.0f * minBillboardSize; float minVar = minBillboardSize; - float var = (sizes.y + sizes.x); + float var = (sizes.y + sizes.x); ta = ( (var - minVar)/(maxVar - minVar) ); if (ta == 0.0f) return; diff --git a/modules/digitaluniverse/shaders/billboard_vs.glsl b/modules/digitaluniverse/shaders/billboard_vs.glsl index fe427a978e..66e03e2a3c 100644 --- a/modules/digitaluniverse/shaders/billboard_vs.glsl +++ b/modules/digitaluniverse/shaders/billboard_vs.glsl @@ -28,10 +28,13 @@ in vec4 in_position; in vec4 in_colormap; +in float in_dvarScaling; -out vec4 colorMap; +flat out vec4 colorMap; +flat out float dvarScaling; void main() { - colorMap = in_colormap; - gl_Position = vec4(in_position); -} \ No newline at end of file + colorMap = in_colormap; + dvarScaling = in_dvarScaling; + gl_Position = in_position; +} diff --git a/modules/space/rendering/renderablestars.cpp b/modules/space/rendering/renderablestars.cpp index 474e7158b3..f5ba7cf51c 100644 --- a/modules/space/rendering/renderablestars.cpp +++ b/modules/space/rendering/renderablestars.cpp @@ -69,6 +69,8 @@ namespace { constexpr const int PsfMethodSpencer = 0; constexpr const int PsfMethodMoffat = 1; + constexpr double PARSEC = 0.308567756E17; + struct CommonDataLayout { std::array position; float value; @@ -276,6 +278,20 @@ namespace { "Beta", "Moffat's Beta Constant." }; + + constexpr openspace::properties::Property::PropertyInfo FadeInDistancesInfo = { + "FadeInDistances", + "Fade-In Start and End Distances", + "These values determine the initial and final distances from the center of " + "our galaxy from which the astronomical object will start and end " + "fading-in." + }; + + constexpr openspace::properties::Property::PropertyInfo DisableFadeInInfo = { + "DisableFadeIn", + "Disable Fade-in effect", + "Enables/Disables the Fade-in effect." + }; } // namespace namespace openspace { @@ -374,6 +390,18 @@ documentation::Documentation RenderableStars::Documentation() { Optional::No, SizeCompositionOptionInfo.description }, + { + FadeInDistancesInfo.identifier, + new Vector2Verifier, + Optional::Yes, + FadeInDistancesInfo.description + }, + { + DisableFadeInInfo.identifier, + new BoolVerifier, + Optional::Yes, + DisableFadeInInfo.description + }, } }; } @@ -425,6 +453,13 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary) , _userProvidedTextureOwner(UserProvidedTextureOptionInfo) , _parametersOwner(ParametersOwnerOptionInfo) , _moffatMethodOwner(MoffatMethodOptionInfo) + , _fadeInDistance( + FadeInDistancesInfo, + glm::vec2(0.f), + glm::vec2(0.f), + glm::vec2(100.f) + ) + , _disableFadeInDistance(DisableFadeInInfo, true) { using File = ghoul::filesystem::File; @@ -634,6 +669,14 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary) addPropertySubOwner(_userProvidedTextureOwner); addPropertySubOwner(_parametersOwner); addPropertySubOwner(_moffatMethodOwner); + + if (dictionary.hasKey(FadeInDistancesInfo.identifier)) { + glm::vec2 v = dictionary.value(FadeInDistancesInfo.identifier); + _fadeInDistance = v; + _disableFadeInDistance = false; + addProperty(_fadeInDistance); + addProperty(_disableFadeInDistance); + } } RenderableStars::~RenderableStars() {} @@ -944,7 +987,22 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) { _program->setUniform(_uniformCache.radiusCent, _radiusCent); _program->setUniform(_uniformCache.brightnessCent, _brightnessCent); - _program->setUniform(_uniformCache.alphaValue, _alphaValue); + float fadeInVariable = 1.f; + if (!_disableFadeInDistance) { + float distCamera = static_cast(glm::length(data.camera.positionVec3())); + const glm::vec2 fadeRange = _fadeInDistance; + const float a = 1.f / ((fadeRange.y - fadeRange.x) * PARSEC); + const float b = -(fadeRange.x / (fadeRange.y - fadeRange.x)); + const float funcValue = a * distCamera + b; + fadeInVariable *= funcValue > 1.f ? 1.f : funcValue; + + _program->setUniform(_uniformCache.alphaValue, _alphaValue * fadeInVariable); + } + else { + _program->setUniform(_uniformCache.alphaValue, _alphaValue); + } + + ghoul::opengl::TextureUnit psfUnit; psfUnit.activate(); @@ -1392,10 +1450,17 @@ void RenderableStars::readSpeckFile() { float minLumValue = std::numeric_limits::max(); float maxLumValue = std::numeric_limits::min(); + bool first = true; do { std::vector values(_nValuesPerStar); - std::getline(file, line); + if (!first) { + std::getline(file, line); + } + else { + first = false; + } + std::stringstream str(line); for (int i = 0; i < _nValuesPerStar; ++i) { diff --git a/modules/space/rendering/renderablestars.h b/modules/space/rendering/renderablestars.h index 272b6b9242..a84e7632c7 100644 --- a/modules/space/rendering/renderablestars.h +++ b/modules/space/rendering/renderablestars.h @@ -123,6 +123,8 @@ private: properties::PropertyOwner _userProvidedTextureOwner; properties::PropertyOwner _parametersOwner; properties::PropertyOwner _moffatMethodOwner; + properties::Vec2Property _fadeInDistance; + properties::BoolProperty _disableFadeInDistance; std::unique_ptr _program; UniformCache( diff --git a/modules/space/shaders/star_ge.glsl b/modules/space/shaders/star_ge.glsl index ef686eb39d..dcb36a5711 100644 --- a/modules/space/shaders/star_ge.glsl +++ b/modules/space/shaders/star_ge.glsl @@ -60,6 +60,7 @@ uniform dmat4 cameraViewProjectionMatrix; uniform dmat4 modelMatrix; const double PARSEC = 3.08567756E16; +//const double PARSEC = 3.08567782E16; const vec2 corners[4] = vec2[4]( vec2(0.0, 0.0), @@ -78,16 +79,6 @@ float bvToKelvin(float bv) { } void main() { - vs_position = gl_in[0].gl_Position; // in object space - - // JCC: Don't display the Sun for now. - if ((vs_position.x == 0.0) && - (vs_position.y == 0.0) && - (vs_position.z == 0.0)) - { - return; - } - vs_position = gl_in[0].gl_Position; // in object space dvec4 dpos = modelMatrix * dvec4(vs_position); @@ -112,13 +103,15 @@ void main() { double distanceToStar = length((dpos.xyz - eyePosition)); double apparentBrightness = pSize * luminosity / (distanceToStar); scaleMultiply = apparentBrightness; - } else if (psfParamConf == 1) { + } + else if (psfParamConf == 1) { float L_over_Lsun = pow(2.51f, SunAbsMagnitude - ge_bvLumAbsMagAppMag.z); float starTemperature = bvToKelvin(ge_bvLumAbsMagAppMag.x); float starRadius = SunRadius * pow(SunTemperature/starTemperature, 2.f) * sqrt(L_over_Lsun); scaleMultiply = ((lumCent * (ge_bvLumAbsMagAppMag.y + 5E9)) + (radiusCent * double(starRadius))) * pow(10.0, magnitudeExponent); - } else if (psfParamConf == 2) { + } + else if (psfParamConf == 2) { double luminosity = double(1.0 - ge_bvLumAbsMagAppMag.y); double distanceToStarInParsecs = trunc(length(dpos.xyz - eyePosition) / PARSEC); double apparentBrightness = luminosity / distanceToStarInParsecs; @@ -130,10 +123,12 @@ void main() { (radiusCent * double(starRadius)) + (brightnessCent * apparentBrightness * 5E15)) * pow(10.0, magnitudeExponent); - } else if (psfParamConf == 3) { + } + else if (psfParamConf == 3) { float absMag = ge_bvLumAbsMagAppMag.z; scaleMultiply = (-absMag + 35.f) * pow(10.0, magnitudeExponent + 8.5f); - } else if (psfParamConf == 4) { + } + else if (psfParamConf == 4) { float absMag = vs_bvLumAbsMagAppMag[0].z; double distanceToStarInMeters = length(dpos.xyz - eyePosition); double distanceToCenterInMeters = length(eyePosition); @@ -151,7 +146,8 @@ void main() { //scaleMultiply = appMag * pow(10.0, magnitudeExponent + 8.5f); scaleMultiply = exp((-30.0 - appMag) * 0.45) * pow(10.0, magnitudeExponent + 8.f); //scaleMultiply = pow(10.0, (appMag - absMag)*(1.0/5.0) + 1.0) * pow(10.0, magnitudeExponent + 3.f); - } else if (psfParamConf == 5) { + } + else if (psfParamConf == 5) { float absMag = ge_bvLumAbsMagAppMag.z; scaleMultiply = exp((-30.623 - absMag) * 0.462) * pow(10.0, magnitudeExponent + 12.5f) * 2000; } diff --git a/openspace.cfg b/openspace.cfg index 51b091a9a4..8451311634 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -25,6 +25,7 @@ SGCTConfig = sgct.config.single{} -- A 4k fisheye rendering in a 1024x1024 window -- SGCTConfig = sgct.config.fisheye{1024, 1024, res={4096, 4096}, quality="2k", tilt=27} +-- SGCTConfig = sgct.config.fisheye{1024, 1024, res={4096, 4096}, quality="1k", tilt=27} -- Streaming OpenSpace via Spout to OBS -- SGCTConfig = sgct.config.single{2560, 1440, shared=true, name="WV_OBS_SPOUT1"}