public bool init(Scene scene) { samples = Math.Max(0, samples); UI.printInfo(UI.Module.LIGHT, "Path tracer settings:"); UI.printInfo(UI.Module.LIGHT, " * Samples: %d", samples); return true; }
public bool init(Options options, Scene scene) { up = options.getVector("gi.fake.up", new Vector3(0, 1, 0)).normalize(); sky = options.getColor("gi.fake.sky", Color.WHITE).copy(); ground = options.getColor("gi.fake.ground", Color.BLACK).copy(); sky.mul((float) Math.PI); ground.mul((float) Math.PI); return true; }
public bool init(Options options, Scene scene) { bright = options.getColor("gi.ambocc.bright", Color.WHITE); dark = options.getColor("gi.ambocc.dark", Color.BLACK); samples = options.getInt("gi.ambocc.samples", 32); maxDist = options.getFloat("gi.ambocc.maxdist", 0); maxDist = (maxDist <= 0) ? float.PositiveInfinity : maxDist; return true; }
public bool prepare(Options options, Scene scene, int w, int h) { this.scene = scene; imageWidth = w; imageHeight = h; numBucketsX = ((uint)imageWidth + 31) >> 5;//>>> numBucketsY = ((uint)imageHeight + 31) >> 5;//>>> numBuckets = numBucketsX * numBucketsY; return true; }
public LightServer(Scene scene) { this.scene = scene; lights = new LightSource[0]; causticPhotonMap = null; shaderOverride = null; shaderOverridePhotons = false; maxDiffuseDepth = 1; maxReflectionDepth = 4; maxRefractionDepth = 4; causticPhotonMap = null; giEngine = null; }
public void updateScene(Scene scene) { if (rebuildInstanceList) { UI.printInfo(UI.Module.API, "Building scene instance list for rendering ..."); int numInfinite = 0, numInstance = 0; foreach (KeyValuePair<string, RenderObjectHandle> e in renderObjects) { Instance i = e.Value.getInstance(); if (i != null) { i.updateBounds(); if (i.getBounds() == null) numInfinite++; else numInstance++; } } Instance[] infinite = new Instance[numInfinite]; Instance[] instance = new Instance[numInstance]; numInfinite = numInstance = 0; foreach (KeyValuePair<string, RenderObjectHandle> e in renderObjects) { Instance i = e.Value.getInstance(); if (i != null) { if (i.getBounds() == null) { infinite[numInfinite] = i; numInfinite++; } else { instance[numInstance] = i; numInstance++; } } } scene.setInstanceLists(instance, infinite); rebuildInstanceList = false; } if (rebuildLightList) { UI.printInfo(UI.Module.API, "Building scene light list for rendering ..."); List<LightSource> lightList = new List<LightSource>(); foreach (KeyValuePair<string, RenderObjectHandle> e in renderObjects) { LightSource light = e.Value.getLight(); if (light != null) lightList.Add(light); } scene.setLightList(lightList.ToArray()); rebuildLightList = false; } }
public bool init(Scene scene) { return true; }
public bool init(Scene scene) { // check settings samples = Math.Max(0, samples); minSpacing = Math.Max(0.001f, minSpacing); maxSpacing = Math.Max(0.001f, maxSpacing); // display settings UI.printInfo(UI.Module.LIGHT, "Irradiance cache settings:"); UI.printInfo(UI.Module.LIGHT, " * Samples: %d", samples); if (tolerance <= 0) UI.printInfo(UI.Module.LIGHT, " * Tolerance: off"); else UI.printInfo(UI.Module.LIGHT, " * Tolerance: %.3f", tolerance); UI.printInfo(UI.Module.LIGHT, " * Spacing: %.3f to %.3f", minSpacing, maxSpacing); // prepare root node Vector3 ext = scene.getBounds().getExtents(); root = new Node(scene.getBounds().getCenter(), 1.0001f * MathUtils.max(ext.x, ext.y, ext.z), this); // init global photon map return (globalPhotonMap != null) ? scene.calculatePhotons(globalPhotonMap, "global", 0) : true; }
/** * Reset the state of the API completely. The object table is cleared, and * all search paths areset back to their default values. */ public void reset() { scene = new Scene(); includeSearchPath = new SearchPath("include"); textureSearchPath = new SearchPath("texture"); parameterList = new ParameterList(); renderObjects = new RenderObjectMap(); currentFrame = 1; }
public bool init(Scene scene) { if (numSets < 1) numSets = 1; UI.printInfo(UI.Module.LIGHT, "Instant Global Illumination settings:"); UI.printInfo(UI.Module.LIGHT, " * Samples: {0}", numPhotons); UI.printInfo(UI.Module.LIGHT, " * Sets: {0}", numSets); UI.printInfo(UI.Module.LIGHT, " * Bias bound: {0}", c); UI.printInfo(UI.Module.LIGHT, " * Bias rays: {0}", numBias); virtualLights = new PointLight[numSets][]; if (numPhotons > 0) { for (int i = 0, seed = 0; i < virtualLights.Length; i++, seed += numPhotons) { PointLightStore map = new PointLightStore(this); if (!scene.calculatePhotons(map, "virtual", seed)) return false; virtualLights[i] = map.virtualLights.ToArray(); UI.printInfo(UI.Module.LIGHT, "Stored {0} virtual point lights for set {0} of {0}", virtualLights[i].Length, i + 1, numSets); } } else { // create an empty array for (int i = 0; i < virtualLights.Length; i++) virtualLights[i] = new PointLight[0]; } return true; }
public bool prepare(Options options, Scene scene, int w, int h) { this.scene = scene; imageWidth = w; imageHeight = h; // fetch options bucketSize = options.getInt("bucket.size", bucketSize); bucketOrderName = options.getstring("bucket.order", bucketOrderName); minAADepth = options.getInt("aa.min", minAADepth); maxAADepth = options.getInt("aa.max", maxAADepth); superSampling = options.getInt("aa.samples", superSampling); displayAA = options.getbool("aa.display", displayAA); jitter = options.getbool("aa.jitter", jitter); contrastThreshold = options.getFloat("aa.contrast", contrastThreshold); // limit bucket size and compute number of buckets in each direction bucketSize = MathUtils.clamp(bucketSize, 16, 512); int numBucketsX = (imageWidth + bucketSize - 1) / bucketSize; int numBucketsY = (imageHeight + bucketSize - 1) / bucketSize; bucketOrder = BucketOrderFactory.create(bucketOrderName); bucketCoords = bucketOrder.getBucketSequence(numBucketsX, numBucketsY); // validate AA options minAADepth = MathUtils.clamp(minAADepth, -4, 5); maxAADepth = MathUtils.clamp(maxAADepth, minAADepth, 5); superSampling = MathUtils.clamp(superSampling, 1, 256); invSuperSampling = 1.0 / superSampling; // compute AA stepping sizes subPixelSize = (maxAADepth > 0) ? (1 << maxAADepth) : 1; minStepSize = maxAADepth >= 0 ? 1 : 1 << (-maxAADepth); if (minAADepth == maxAADepth) maxStepSize = minStepSize; else maxStepSize = minAADepth > 0 ? 1 << minAADepth : subPixelSize << (-minAADepth); useJitter = jitter && maxAADepth > 0; // compute anti-aliasing contrast thresholds contrastThreshold = MathUtils.clamp(contrastThreshold, 0, 1); thresh = contrastThreshold * (float)Math.Pow(2.0f, minAADepth); // read filter settings from scene filterName = options.getstring("filter", filterName); filter = PluginRegistry.filterPlugins.createObject(filterName); // adjust filter if (filter == null) { UI.printWarning(UI.Module.BCKT, "Unrecognized filter type: \"{0}\" - defaulting to box", filterName); filter = new BoxFilter(); filterName = "box"; } fhs = filter.getSize() * 0.5f; fs = (int)Math.Ceiling(subPixelSize * (fhs - 0.5f)); // prepare QMC sampling sigmaOrder = Math.Min(QMC.MAX_SIGMA_ORDER, Math.Max(0, maxAADepth) + 13); // FIXME: how big should the table be? sigmaLength = 1 << sigmaOrder; UI.printInfo(UI.Module.BCKT, "Bucket renderer settings:"); UI.printInfo(UI.Module.BCKT, " * Resolution: {0}x{1}", imageWidth, imageHeight); UI.printInfo(UI.Module.BCKT, " * Bucket size: {0}", bucketSize); UI.printInfo(UI.Module.BCKT, " * Number of buckets: {0}x{1}", numBucketsX, numBucketsY); if (minAADepth != maxAADepth) UI.printInfo(UI.Module.BCKT, " * Anti-aliasing: {0} -> {1} (adaptive)", aaDepthTostring(minAADepth), aaDepthTostring(maxAADepth)); else UI.printInfo(UI.Module.BCKT, " * Anti-aliasing: {0} (fixed)", aaDepthTostring(minAADepth)); UI.printInfo(UI.Module.BCKT, " * Rays per sample: {0}", superSampling); UI.printInfo(UI.Module.BCKT, " * Subpixel jitter: {0}", useJitter ? "on" : (jitter ? "auto-off" : "off")); UI.printInfo(UI.Module.BCKT, " * Contrast threshold: {0}", contrastThreshold); UI.printInfo(UI.Module.BCKT, " * Filter type: {0}", filterName); UI.printInfo(UI.Module.BCKT, " * Filter size: {0} pixels", filter.getSize()); return true; }