Zhejiang,China

service@bio-mapper.com

For Sketchup - Vray Render Settings

end end module VRaySettingsManager PRESETS_DIR = File.join(ENV['APPDATA'] || ENV['HOME'], "SketchUp/VRaySettings") def save_custom_preset(name) Dir.mkdir(PRESETS_DIR) unless Dir.exist?(PRESETS_DIR) data = current_settings_as_hash return unless data

def apply_custom_preset(preset_hash) return unless vray settings = vray.settings

def vray_loaded? defined?(VRay) && VRay.const_defined?(:Renderer) rescue false end

# Quality multiplier (custom property) settings.set("system/raycaster/quality", preset["quality"]) vray render settings for sketchup

settings.set("imageSampler/type", preset_hash["image_sampler"]) settings.set("imageSampler/progressive/minSubdivs", preset_hash["min_subdivs"]) settings.set("imageSampler/progressive/maxSubdivs", preset_hash["max_subdivs"]) settings.set("imageSampler/progressive/noiseThreshold", preset_hash["noise_threshold"]) settings.set("gi/on", preset_hash["gi_enabled"]) settings.set("gi/primaryEngine", preset_hash["gi_primary"]) settings.set("gi/secondaryEngine", preset_hash["gi_secondary"]) settings.set("output/width", preset_hash["resolution_width"]) settings.set("output/height", preset_hash["resolution_height"]) settings.set("system/raycaster/quality", preset_hash["quality"])

# Output resolution settings.set("output/width", preset["resolution_width"]) settings.set("output/height", preset["resolution_height"])

preset = JSON.parse(File.read(file_path)) apply_custom_preset(preset) end end end module VRaySettingsManager PRESETS_DIR = File

This is a complete guide to developing a feature for SketchUp (using the V-Ray for SketchUp API and Ruby).

# GI settings.set("gi/on", preset["gi_enabled"]) if preset["gi_enabled"] settings.set("gi/primaryEngine", preset["gi_primary"]) settings.set("gi/secondaryEngine", preset["gi_secondary"]) end

file_path = File.join(PRESETS_DIR, "#name.json") File.open(file_path, "w") do |f| f.write(JSON.pretty_generate(data)) end UI.messagebox("Preset saved as #name") end def vray return nil unless vray_loaded

UI.messagebox("Custom preset applied") end end SketchUp uses HTML dialogs for cross-platform UI.

def vray return nil unless vray_loaded? VRay::Renderer.instance end end module VRaySettingsManager DEFAULT_PRESETS = "Draft" => "image_sampler" => "Fixed", "min_subdivs" => 1, "max_subdivs" => 4, "noise_threshold" => 0.05, "gi_enabled" => false, "gi_primary" => "Brute force", "gi_secondary" => "None", "resolution_width" => 800, "resolution_height" => 600, "quality" => 0.3 , "Medium" => "image_sampler" => "Progressive", "min_subdivs" => 1, "max_subdivs" => 16, "noise_threshold" => 0.01, "gi_enabled" => true, "gi_primary" => "Brute force", "gi_secondary" => "Light cache", "resolution_width" => 1920, "resolution_height" => 1080, "quality" => 0.6 , "High" => "image_sampler" => "Progressive", "min_subdivs" => 1, "max_subdivs" => 32, "noise_threshold" => 0.005, "gi_enabled" => true, "gi_primary" => "Brute force", "gi_secondary" => "Light cache", "resolution_width" => 3840, "resolution_height" => 2160, "quality" => 0.9 end Step 3: Apply Settings to V-Ray module VRaySettingsManager def apply_preset(preset_name) preset = DEFAULT_PRESETS[preset_name] return unless preset && vray # Access V-Ray settings through its API settings = vray.settings

UI.messagebox("Applied preset: #preset_name") end end module VRaySettingsManager def current_settings_as_hash return nil unless vray settings = vray.settings "image_sampler" => settings.get("imageSampler/type"), "min_subdivs" => settings.get("imageSampler/progressive/minSubdivs"), "max_subdivs" => settings.get("imageSampler/progressive/maxSubdivs"), "noise_threshold" => settings.get("imageSampler/progressive/noiseThreshold"), "gi_enabled" => settings.get("gi/on"), "gi_primary" => settings.get("gi/primaryEngine"), "gi_secondary" => settings.get("gi/secondaryEngine"), "resolution_width" => settings.get("output/width"), "resolution_height" => settings.get("output/height"), "quality" => settings.get("system/raycaster/quality")

# Image sampler settings.set("imageSampler/type", preset["image_sampler"]) settings.set("imageSampler/fixed/subdivs", preset["min_subdivs"]) settings.set("imageSampler/progressive/minSubdivs", preset["min_subdivs"]) settings.set("imageSampler/progressive/maxSubdivs", preset["max_subdivs"]) settings.set("imageSampler/progressive/noiseThreshold", preset["noise_threshold"])

You can implement this as a SketchUp extension ( .rb file) that adds a UI panel to manage V-Ray render settings presets (low, medium, high, custom), with the ability to apply, save, and export/import settings. Feature Name: V-Ray Render Settings Manager Purpose: Allow users to quickly switch between render quality presets, adjust key V-Ray settings (image sampler, GI, lights, materials), and save/load presets without diving into the V-Ray Asset Editor.

Scroll to Top