Jump to content
The Dark Mod Forums

Tweak of grandfather clock 'anim'


SneaksieDave

Recommended Posts

Not really a model animation I guess, but I'm not sure where else to put this. I made a tweak to the old pendulum movement to try to make it more like a real one ( e.g.

) which move in a much smaller arc and slower. Vid shows original movement compared to new. Let me know if you think it's good enough to commit to SVN.

 

video

Link to comment
Share on other sites

Fine with me. Did you create a new table for it? I'd like to keep the old one for use with gauges.

Link to comment
Share on other sites

Okay committed with both tables intact.

 

Is there a way to adjust the time? I didn't deduce one from looking at the mtr file. It appears the clock always starts at about 6:37 pm which is probably not ideal for thieving missions.

 

"Mum, did ye hear something?"

"'Twas just the wind. Pass the rolls and gravy please?"

Link to comment
Share on other sites

If that's the case, then I'd be inclined to say that the UV map needs to be changed in the clock face itself, because otherwise any other model which currently uses the clock arms (I'm assuming there are more... maybe machinery?) will get screwed up with a change. I'd give it a shot but it looks like while Blender can import an LWO, it cannot get the UVs on one.

Link to comment
Share on other sites

Hmm, that should work. Can you make a tracker entry and assign it to me so I don't forget?

Link to comment
Share on other sites

If the texture is round, then you can do the time via shaderparms.

 

The back layer would be a simple background (white with numbers), then on that would be a minute hand layer, and then an hour hand layer. These could be adjusted to automatically spin over a set period of time constantly (so for the hour hand it would rotate 0.00833 degrees per second, equaling 360 degrees over twelve hours.

 

The default rotation offset would be tweaked via shaderparm, which would specify the hour and minute.

 

Just needs for the minute hand and hour hand to be separate images, as well as the background.

 

I don't think a second hand would be necessary (afaik most grandfather clocks don't have minute hands?).

 

Would be awesome to return to a room and find the time really does change.

Link to comment
Share on other sites

These could be adjusted to automatically spin over a set period of time constantly (so for the hour hand it would rotate 0.00833 degrees per second, equaling 360 degrees over twelve hours.

 

That part is already done.

 

The default rotation offset would be tweaked via shaderparm, which would specify the hour and minute.

 

How is that done?

Link to comment
Share on other sites

How is that done?

 

Looking into the TDM folders I see the clock animation is done via model, rather then material. If it were done via material, then you could add the following to make it turn over the set period of time:

 

textures/darkmod/tessssting
{
   noSelfShadow
   noShadows
   twosided

   // Hour hand
   {
       blend diffusemap
       map models/md5/props/gfclock/gfclock_d
       clamp
       rotate (8.333 * (time * 0.0001)) + (Parm7 * 0.00833)
   }
}

 

Set shaderParm7 on the entity that uses the texture equal to the hours that it should start at.

 

Of course this would require tweaking, but it is possible.

Link to comment
Share on other sites

There is a version that does it with models, but we're talking about the one that uses animated textures.

 

Set shaderParm7 on the entity that uses the texture equal to the hours that it should start at.

 

So shaderParm7 is just some universal variable? What does it default to?

Link to comment
Share on other sites

So shaderParm7 is just some universal variable? What does it default to?

 

It is a shader parameter that can be set in scripts, on entities etc, and thus used to affect the materials of that particular entity. On the other hand you have global shader parameters, which are adjusted globally and affect all materials using the globalparms. For example the texture ambient method uses this. Our colored lamps use shaderParm 0, 1 and 2 for color. ShaderParm7 is nothing special, I just chose 7 because I use it for the particle leaves.

 

ShaderParm7 defaults to 0.

Link to comment
Share on other sites

Yes, so you can have one clock set to show 8 while the other 10 etc, as long as that shaderParm (be it whichever number you choose to use in the material file) is set on the entity which uses the material. The shaderParm you set on the entity itself.

 

You could also set up a third shaderParm which controls the scale of time passing (for weird missions), so you could have it show time passing at faster then life rates etc etc etc.

Link to comment
Share on other sites

I'd give it a shot but it looks like while Blender can import an LWO, it cannot get the UVs on one.

 

I have definitely imported an LWO with UVs into Blender before, but I have a feeling you need to download a separate import script rather than using the one packaged with Blender.

Link to comment
Share on other sites

I think you're right, that does ring a bell. I was only trying the native import support so far. It's great that they got that in, even if it's not yet complete; and full ASE support is native finally! Yay. Blender has really impressed me in this re-visit. OSS is one of the world's greatest things. :)

 

Anyone want to try Dram's suggestions above? I'm really curious about this. It'd be excellent if mappers could actually set the time for the clock in a mission.

Link to comment
Share on other sites

@Dram: any further suggestions on this? When you said tweaking, you really meant it...

 

I took the original equation and started mucking with the numbers to see what does what, and so far this is where it's at:

 

rotate (2.8 * (time * 0.0001)) + (shaderparm7 * .0833)

 

The first parens create the slow movement. 2.8 was borrowed from the original numbers in the shader, and seem to be as close to proper minute movement as we're going to get. I did blind tests with a straightedge on the monitor and a stopwatch and got: 58 sec, and 1min 1sec. So it's really close. Where did 8.333 come from, I'm wondering?

 

The second parens create proper 5-minute separations. They are not the correct time, meaning setting it to 11 might give you some value near 7:30, but at least whole numbers are 5 minutes apart. Was it .00833 for any necessary reason?

 

Working:

* Proper minute motion

* Proper 5 minute spacing by whole numbers on shaderparm7

 

Not working:

* Proper hand placement for the minute time. Yes, they're 5 mins apart, but not at the correct times. Need some math person for that I think, or a lot of trial and error. I assume it will have another set of parens.

* Any work on the hour hand at all (none attempted yet)

* Would the hour hand use a different shaderparm?

 

linton_clockmaker1.jpg

Link to comment
Share on other sites

To explain, the example I gave above was for the hour hand, where if you put a value of 3 into shaderparm7 then it would start at 3 o'clock.

 

0.0083333 is:

 

360 degrees over 12 hours || 30 degrees per hour || 0.5 degrees per minute || 0.00833333333333333 degrees per second

 

Since the rotate function is done per second, then you use 0.00833333, but for some reason it doesn't work right when put there like that, so I did 8.3 * (time * 0.0001) to compensate.

Link to comment
Share on other sites

That's not necessary...Fidcal already set the values to work according to real time. The only thing we need is the part that tells the hands where to start.

Link to comment
Share on other sites

That's not necessary...Fidcal already set the values to work according to real time. The only thing we need is the part that tells the hands where to start.

 

Presuming that is for the texture hands version, then you only need to add the + (parm7 * 0.008333) to the end of the rotate function. That will mean that adding +1 to parm7 would add one hour (or 5 minutes etc).

Link to comment
Share on other sites

Thinking about it, I guess that the reason it's off from expected is based on two things: 1.), whatever alignment is on the texture, and 2.), whatever UV alignment of that texture is, on the model. For this to work correctly, it needs to be calibrated correctly. The textures themselves must point exactly up, and the UV map must then align them exactly up. After that, 0 (or 12 or 24) will be midnight. Correct? If so, we need to worry about those first.

Link to comment
Share on other sites

I've modified the hour and minute hands to point straight up (in the texture). However, I recall being somewhat confused when setting them up because they didn't start at the same position as the texture. Maybe that will be fixed by adding Dram's shaderparm line.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 6 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...