Announcement

Collapse
No announcement yet.

I need a time counter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I need a time counter

    Hi.

    Thought, I'd post here, as response and know-how is a lot better than most places.

    I need a way to render the time from the daylight system, either as an object in max that is renderable, or as a stamp\effect type thing.

    The closest I came is with the "counter text" plugin (Cuneyt Ozdas), but I can only plug the solar time controller (from the daylght system) into the "user count" slot on the plugin object, making me divide the result by 3600 to get the hours or seconds (depending on what i set as master in the wire dialog). Preferably, I want the output format to be hours:minutes "13:24" or something similar (24 hour clock).
    Is there no smarter\easier way to go about this? Have any of you guys done anything along these lines before?
    Signing out,
    Christian

  • #2
    i think you can do that quite easy in After Effects?
    or do you really need it at rendertime?

    Comment


    • #3
      You could render your own in max with maxscript if you're up for that,
      Check the section called "Dynamically changing text" or something close to that. It'll provide you with the building block and I can help you with the rest
      Colin Senner

      Comment


      • #4
        Hopefully this works as a good starting point, wrote it a few years ago, not the best at maxscript so might be approaching things some bad ways, but it worked as a first pass hack for us a while ago. hardcoded the sun object's name in as Sun01. Also might need to be updated to work with newer versions of vray, haven't used this since I first wrote it. There are comments scattered throughout, read through them as I wrote them when I first wrote the script, and again, haven't looked at it since, so I'm not promising miracles here. Good luck!

        Code:
        -- Usage:
        -- Apply as a pre-render script (Render Scene Dialog > Common tab > Scripts rollout
        -- Create a sun system object leaving the sun node name as Sun01
        -- Enable Vray Frame stamp
        -- Render
        --
        --
        -- Ideas to expand:
        -- You can either manually add string values that include the current date 
        -- (or any other parameter you wish, including the normal vray frame stamp options, or a basic "caption" item) 
        -- or you could figure out the formatting for using the solar_date parameter of the sun properly. 
        -- I don't have time to do that for the initial version.
        --
        
        
        -- Removes the callbacks we will use in case they already exist
        -- The callbacks seem to be the trick for it run properly for network renders and frame sequences. 
        -- You may not need all 3 callbacks, but during initial testing just using one of these didn't work properly.
        -- and it started working properly when I used all 3, so I kept all 3. 
        -- These same lines need to be ran again to remove the callbacks from your current max session. 
        -- Otherwise, even after a reset the frame stamp text field will be overwritten. 
        
        callbacks.removeScripts id:#solarTimeFrameStampPreRenderEval
        callbacks.removeScripts id:#solarTimeFrameStampPreRenderFrame
        callbacks.removeScripts id:#solarTimeFrameStampPostRenderFrame
        
        
        -- Start of overall function that is called during each callback
        fn solarTimeFrameStamp = (
        
        	--Defines variables used throughout the function
        	solar_time
        	hrs
        	min
        	sec
        	minString
        	timeofday
        	solarTimeString
        	vr
        
        	-- Get current time of sun node in seconds and compute appropriate hours, minutes, and seconds.
        	solar_time = $Sun01.controller[1].object.value
        	hrs = int(solar_time/3600.0)  -- full hours in the solar_time value
        	min = int((solar_time - hrs*3600.0)/60.0)  -- full minutes in the difference between the full time and the full hours
        	sec = int(solar_time - hrs*3600.0 - min*60.0 + 0.5)  -- full seconds in the rest of the value
        
        	-- Format minutes value to be two digits, adding a 0 in front of any single digit value.
        	minString = min as string
        	if minString.count == 1 then minString = "0" + minString
        
        	-- Format afternoon&evening hours for PM and subtract 12 from hours value for 12 hour clock.
        	if hrs >= 12 then (
        		timeofday = "PM"
        		if hrs > 12 then hrs = hrs-12
        		)
        	else timeofday = "AM"
        
        	-- Format hours for midnight = 12:00am instead of midnight = 0:00am do this AFTER AM/PM decision 
        	-- otherwise midnight becomes 12 "pm"
        	if hrs == 0 then hrs = 12 
        
        	-- Construct final string to print
        	-- Optionally add other string items to this for more info in the final frame stamp 
        	-- (ie the sec variable a new solar_date variable or any other text you want)
        	solarTimeString = hrs as string + ":" + minString + timeofday
        
        	-- gets an instance of the current renderer
        	vr = renderers.current
        
        	-- assumes vray and applies the string constructed earlier as the framestampString
        	vr.system_frameStamp_string = solarTimeString
        	)
        
        
        -- Loads the above function as the 3 different callbacks
        callbacks.addScript #preRenderEval "solarTimeFrameStamp()"  id:#solarTimeFrameStampPreRenderEval
        callbacks.addScript #preRenderFrame "solarTimeFrameStamp()"  id:#solarTimeFrameStampPreRenderFrame
        callbacks.addScript #postRenderFrame "solarTimeFrameStamp()"  id:#solarTimeFrameStampPostRenderFrame
        | LinkedIn | Twitter | JCanimator.com |

        Comment


        • #5
          I just came across this plugin. http://www.3idee.nl/3d/html/layout.php Seems to work pretty well. The timeslider needs to be moved to update it. It only does time, not date, but it's a start.
          Also, it works with the sunlight system, but not daylight system. I've been using the daylight system to add vraysun (normal max sunlight system can't be changed to vraysun), but to use a vraysun with sunlight system just turn off sunlight system sun, create a new vray sun, move target and sun to same positions as sunlight system and 'select and link'.

          I'm surprised there isn't a feature to render a frame stamp of time and date from the sunlight system in 3ds max already.
          Last edited by add101; 02-12-2011, 05:36 AM.

          Comment

          Working...
          X