Skatter XML overwriting vray XML

Getting kind of a weird issue when using sketchup, vray, skatter and our render farm (via RenderPal). Basically, with a simple skatter forest, we can open the file locally and then hit render, and it works fine. However, when we submit to the farm, the client opens the file and auto renders (via some XML and ruby scripts that instruct sketchup/vray to do so), and the skatter forest does not show up. Digging around in some files I found some errors pointing to Skatter overwriting something in the process.

As an example, here is what the output log should look like (our workaround here was unchecking the “render only” button):

=== 2016-0224 Elk Street Park.skp, Chunk 1 - 2/26/2016 12:38:39 PM =================================
 Scenes:   CLIENTS NAME REMOVED
 Section:  Frames: 1.000 - 1.000, Region: Entire image
 Renderer: V-Ray for SketchUp/2015+
=== Started ========================================================================================

> "C:\Program Files\SketchUp\SketchUp 2015\SketchUp.exe" -RubyStartup "C:\Program Files (x86)\RenderPal V2\Client\Temp\RpScript_0157_001.rb" "c:\users\user\appdata\local\temp\rpSketchUp_157_1_2016-0224 Elk Street Park.skp"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Intrinsic Alchemy v3.7 Beta-0403 (Dynamic/Release)
Built by <unknown> on Thu Apr 3 00:00:00 2014

Done processing compdefs - Elapsed time: 4.394

Scene processed in 4.904 seconds
width: 5500
height: 3666
Rendering frame 1 of 1 to CLIENTS NAME REMOVED view3_crab1.tif

==== V-Ray for SketchUp =====
Done processing compdefs - Elapsed time: 2.893

Scene processed in 3.397 seconds
It took 20.024 seconds to create our xml file

Scene fully processed in 466.405 seconds
-----

Successfully exported frame 1 of 1 to V:/XXXXXXX/psd-jpg/View03_Elk/view3_crab1.tif
Finished exporting 2d image sequence to V:/XXXXXXXX/psd-jpg/View03_Elk
vfs.rb loaded

R2P.rb loaded

R2PCallbacks.rb loaded

VfSExport.rb loaded

VfSObservers.rb loaded

skpHelperClasses.rb loaded

VfSCommands.rb loaded

R2PToolbar.rb loaded

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

=== 2016-0224 Elk Street Park.skp, Chunk 1 - 2/26/2016 1:12:18 PM ==================================
 Duration: 33 min 39 sec		Avg. CPU usage: 32%		CPU idle time: 22 min 54 sec
 Result:   Finished
=== Done ===========================================================================================

By contrast, here is the output log in which the forest does not appear:

=== grass test.skp (Copy), Chunk 1 - 2/26/2016 2:06:17 PM ==========================================
 Scenes:   V:/Tmp/skatter test/grass test.skp
 Section:  Frames: 1.000 - 1.000, Region: Entire image
 Renderer: V-Ray for SketchUp/2015+
=== Started ========================================================================================

> "C:\Program Files\SketchUp\SketchUp 2015\SketchUp.exe" -RubyStartup "C:\Program Files (x86)\RenderPal V2\Client\Temp\RpScript_0162_001.rb" "c:\users\user\appdata\local\temp\rpSketchUp_162_1_grass test.skp"
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Intrinsic Alchemy v3.7 Beta-0403 (Dynamic/Release)
Built by <unknown> on Thu Apr 3 00:00:00 2014

Done processing compdefs - Elapsed time: 0.022

Scene processed in 0.046 seconds
width: 1000
height: 562
Rendering frame 1 of 1 to V:/Tmp/skatter test/grass native1.png

==== V-Ray for SketchUp =====
Done processing compdefs - Elapsed time: 0.021

Scene processed in 0.044 seconds
It took 0.398 seconds to create our xml file

Scene fully processed in 0.882 seconds
-----

---- Skatter ----
Regenerate render instances from attributes : 0.236069 s
---- End ----

Skatter overwrote Vray's 'write_to_xml'
Successfully exported frame 1 of 1 to V:/Tmp/skatter test/grass native1.png
Finished exporting 2d image sequence to V:/Tmp/skatter test
DL is deprecated, please use Fiddle

vfs.rb loaded

R2P.rb loaded

R2PCallbacks.rb loaded

VfSExport.rb loaded

VfSObservers.rb loaded

skpHelperClasses.rb loaded

VfSCommands.rb loaded

R2PToolbar.rb loaded

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

=== grass test.skp (Copy), Chunk 1 - 2/26/2016 2:06:48 PM ==========================================
 Duration: 30 sec		Avg. CPU usage: 23%		CPU idle time: 23 sec
 Result:   Finished
=== Done ===========================================================================================


Which version of Vray are you using?

Using SU 2015 and vray 2.00.25244. Note: there are newer versions of vray, however, we are not able to use them because this is the least bug free version for our use (and it still has PLENTY of bugs). The newer versions breaks distributed rendering, so patching vray isn’t an option.

Only the latest version of Vray officially supports Skatter.
For previous versions, Skatter does a workaround to patch Vray on the fly and make it work, but that’s very hacky… I guess that’s what breaks when you execute the render via a script.

Ouch, thats not good news. Right now we got 4 skatter licenses in our office, but we are stuck on vray 25244 until chaos fixes their Nov '15 patch which broke half of vray (its been 3 months, so I’m not betting on this) or the big update to vray 3.0 (which is still a ways out).

Any advice? It would seem the only way forward would be to use Skatter, uncheck “render only” and then send to the farm.

Is it possible to have a delay in your script between the time the file is opened, and the time the render is actually launched?
Like 3 seconds, just to make sure Vray and Skatter fully load before the render starts.

I think that would do it. I was trying to implement that late last week, but ultimately thats a bit beyond my skill set. I’ll keep working that and maybe the folks at renderpal can help me out in creating a custom script that delays.

thanks for the help, hopefully vray gets their software right soon (doubtful though)

Whelp, one fix causes another issue: is there a limitation to how many skatter groups can be unchecked as “render only”? Reason I’m asking is because I have a model with maybe 10 skatter forests. I uncheck 1 as render only, regen, then edit the following forest, uncheck “render only”, regen, and the first forest disappears.

Thanks

You need to click “Generate” after unchecking “Render only”.

Right. As I mentioned, uncheck, regen, edit following forest, uncheck, regen, and first forest disappears. I can duplicate this issue on command, see gif below for example (if I did it right…)

[RB : GIF removed as the point was made…]

Jay H, Contact Chaosgroup and see if they can send you a nightly build. Maybe that works!

Regards,

I’m aware of the nightly builds and how it potentially fixes vray and the DR issue, however, I turned chaos group down because we have a decent sized studio and render farm all reliant on stable vray operation, and I can’t lose that ability to test out a nightly build and HOPE that it doesn’t break another integral part of the software. Frankly, I’m just upset that a simple patch takes more than 3 months to make, but thats another rant for another time.

Thanks

Thanks for the gif.
I think I have an idea where the issue can come from.
Try closing and reopening the Skatter dialog between each edit/generate, and see if the issue persists.

Yes, that did it. So for anyone else that has the same issue, the sequence that worked for me is: edit forest, uncheck “render only”, regen, close skatter dialog box, open skatter dialog box, edit forest repeat etc.

Thanks for the help, really appreciate it!

Thanks for the confirmation, I should be able to fix it soon.

Thomas,

Just a quick note, we’ve since updated to vray version 26579 (just released last week), and the grass is still not functioning properly with our Renderpal render farm software. Oddly enough, the error I got before regarding Skatter overwriting vray’s XML file is gone, however, the skatter objects still don’t show up. I’m assuming this would be the case for all batch/scripted renderings that auto-render upon opening.

I’m still trying to insert a delay command in between the file opening and the render starting, but I’m way out of my element when it comes to Ruby. There is a portion of Renderpal’s ruby script that has (see below), and I’m thinking a delay command MAY fit in there, but I’m really not sure. Any thoughts or help would be immensely appreciated.

begin
			#currentImgPath = self.append_to_filename( origPath, "-#{pages[i].name}" )
			VRayForSketchUp.set_option_value("/SettingsOutput", "img_file", "string", output_path)

			VRayForSketchUp.launch_vray_render
			# wait for render to start
			while not PythonBridge.is_rendering_image()
				PythonBridge.pump_message
			end

			# wait for render to finish
			while not PythonBridge.is_render_finished()
				PythonBridge.pump_message
			end

			#break if PythonBridge.was_render_cancelled()
			$stdout.flush
			
			puts "Successfully exported frame #{@frame} of #{@end_frame} to #{output_path}"
		rescue
			puts "Error: Failed to write image sequence: #{output_path}, check input and folder permissions"
			
			close_sketchup
			return
		end

Try this:

UI.start_timer(1, false) {
		begin
			#currentImgPath = self.append_to_filename( origPath, "-#{pages[i].name}" )
			VRayForSketchUp.set_option_value("/SettingsOutput", "img_file", "string", output_path)

			VRayForSketchUp.launch_vray_render
			# wait for render to start
			while not PythonBridge.is_rendering_image()
				PythonBridge.pump_message
			end

			# wait for render to finish
			while not PythonBridge.is_render_finished()
				PythonBridge.pump_message
			end

			#break if PythonBridge.was_render_cancelled()
			$stdout.flush
			
			puts "Successfully exported frame #{@frame} of #{@end_frame} to #{output_path}"
		rescue
			puts "Error: Failed to write image sequence: #{output_path}, check input and folder permissions"
			
			close_sketchup
			return
		end
}

Well, some progress. It stops the operation at that point, but doesn’t continue to render. BTW, I can’t thank you enough for the help. We have 4 licenses in our office right now and are having to render locally as a temporary measure until we get this up and running with our render farm

I should have included the full script the first time:

require "sketchup.rb"

class AnimationExport
	def initialize
		@pages = $model.pages
		
		if @pages[1] == nil
			puts "Error: No pages were found, ensure that you have at least 2 pages before exporting an image sequence"
			
			close_sketchup
			return
		end	
			
		if $chunkEndFrame != nil
			@end_frame = $chunkEndFrame
		else
			@end_frame = (($model.pages.slideshow_time * $frame_rate) + 1).to_i
		end
		
		if $chunkStartFrame != nil
			@frame = $chunkStartFrame
		else
			@frame = 1
		end

		@frame_interval	= 1.0 / $frame_rate
		@frame_count	= @end_frame
		@end_time		= $model.pages.slideshow_time
		
		Sketchup.active_model.active_view.animation = self
	end
	
	def update_view(view)

	end
	
	def nextFrame(view)
		Sketchup.active_model.active_view.animation = nil 

		frame_fmt	= "%0" + "#{$padding}" + "d"
		frame_num	= sprintf frame_fmt, @frame
		
		output_file	= File.basename($output_name, File.extname($output_name)) + frame_num + $format
		output_path	= File.join($output_directory, output_file)

		if @frame > @end_frame
			Sketchup.set_status_text("Finished exporting 2d image sequence to #{File.dirname(output_path)}")
			puts "Finished exporting 2d image sequence to #{File.dirname(output_path)}"
			
			close_sketchup
			return
		end

		time = @frame * @frame_interval
		@pages.show_frame_at(time.to_f)

		Sketchup.set_status_text("Rendering frame #{@frame} of #{@end_frame} to #{output_path}")
		puts "Rendering frame #{@frame} of #{@end_frame} to #{output_path}"

		begin
			#currentImgPath = self.append_to_filename( origPath, "-#{pages[i].name}" )
			VRayForSketchUp.set_option_value("/SettingsOutput", "img_file", "string", output_path)

			VRayForSketchUp.launch_vray_render
			# wait for render to start
			while not PythonBridge.is_rendering_image()
				PythonBridge.pump_message
			end

			# wait for render to finish
			while not PythonBridge.is_render_finished()
				PythonBridge.pump_message
			end

			#break if PythonBridge.was_render_cancelled()
			$stdout.flush
			
			puts "Successfully exported frame #{@frame} of #{@end_frame} to #{output_path}"
		rescue
			puts "Error: Failed to write image sequence: #{output_path}, check input and folder permissions"
			
			close_sketchup
			return
		end

		@frame += 1

		Sketchup.active_model.active_view.animation = self
	end
end

def is_osx?
	(/darwin/ =~ RUBY_PLATFORM) != nil
end

def is_win?
	(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end

def close_sketchup 
	Sketchup.send_action(57603)
	Sketchup.quit
end

def main
	$stdout	= STDOUT
	$stderr	= STDERR

	$model	= Sketchup.active_model
	$view	= $model.active_view
	
	$output_directory	= "$(outdir)"
	$output_name		= "$(outfile)"
	$format				= "." + "$(imgfmt)"

	if $output_name.chomp == ""
		$output_name = File.basename($model.path, ".skp")
	end
	
	$chunkStartFrame	= nil
	$chunkEndFrame		= nil
	
	$width				= nil
	$height				= nil
	
	$padding			= 1
	
	$frame_rate			= $(fps)

	if $frame_rate == 0
		$frame_rate = 30
	end
	
	VRayForSketchUp.set_option_value("/SettingsOutput", "frames_per_second", "float", $frame_rate)
	
@@skip
	$width	= $(width)
	$height	= $(height)
	
	if $width == 0
		$width = $view.vpwidth
	end

	if $height == 0
		$height = $view.vpheight
	end
	
	VRayForSketchUp.setOutputSize($width, $height)	
@@end

@@skip
	$chunkStartFrame	= $(sf)
	$chunkEndFrame		= $(ef)
@@end	
	
@@skip
	$padding = $(fpadding)
@@end

	VRayForSketchUp.set_option_value("/SettingsOutput", "save_render", "bool", 1)
	
	AnimationExport.new
end

main

Try wrapping the last line in the timer, like this:

	UI.start_timer(1, false) {
		AnimationExport.new
	}

Tom, we’re so close! So timer worked and grass is working! Only only issue (and its a small nit): I think the timer is repeating (or causes something to repeat) because there is a pop up saying “vray is still rendering, please wait” (which happens when you hit the render button when there is already a rendering in progress)

I’m testing it out to see if that has any repercussions or not, so we’ll see

UPDATE: Yeah, its looping. When it finishes, it goes back through the render process again and doesn’t close out the job or get marked as done.