gold coin

Announcements and discussion regarding the forums.
RayB
Posts: 94
Joined: Fri Mar 06, 2015 3:45 am

gold coin

Post by RayB » Fri Mar 20, 2015 7:47 pm

Have been trying to create a new item - a gold coin. Got some nice pics off the net. Created a gfxAtles (DDS) file with two coins in it saved it into the textures folder. Then created the following script in the items.lua file...

cloneObject{
name = "gold_coin",
baseObject = "gold_key",
uiName = "Gold Coin",
gfxAtlas = "mod_assets/textures/Gold Coins.tga",
gfxIndex = 0,
description = "This coin is made of solid gold.",
}

It appears in the items index and when placed in the dungeon, it works but with issues. It seems that because I used a gold_key as the base object, when I approach the coin in the preview I see a gold key laying on the floor. However, when I pick it up it looks like the circular shaped gold coin in the pic but with black in the four corners filling out the rectangle. I assume the black has something to do with the Alpha channel but I thought I read somewhere that Grimrock uses black as the transparent color. Guess I was wrong. Does anyone know how to get rid of the black in the four corners and how to make the floor object look like the coin instead of the gold key?

User avatar
Isaac
Posts: 2836
Joined: Fri Mar 02, 2012 10:02 pm

Re: gold coin

Post by Isaac » Fri Mar 20, 2015 10:52 pm

What image editor are you using for the coin.dds?

For the alpha, you need to ensure that the alpha is black where you want it transparent, and white where you want it to show. Black around the artwork isn't enough; an all white alpha will show the black as part of the art.

Image

https://www.dropbox.com/s/utesutfheps83 ... l.dds?dl=1

In Photoshop, add an alpha channel; in Paint.Net, just make sure that everything around the art is transparent.

Paint.Net has good native dds support; but it's only an option in Windows; or through emulation. GUI images should be in A8R8G8B8 dds format.

If you are going to be doing many custom icons, then John Wordsworth has a great tool for that.
http://www.johnwordsworth.com/legend-of ... s-toolkit/

For the 'key on the floor' problem, replace the model reference with your own [custom] coin model. This can be created in Blender.

* LoG1 Coin project: https://www.dropbox.com/s/pjau57ktpqv7igk/Coin.zip?dl=1

RayB
Posts: 94
Joined: Fri Mar 06, 2015 3:45 am

Re: gold coin

Post by RayB » Sun Mar 22, 2015 12:59 am

No luck so far. Saved coin as .dds using paint.net but when I pick it up in the dungeon previewer the whole pic is transparent. Don't quite know what I am doing wrong.

As far as the 'key on the floor' problem I didn't really grasp your explanation.

Have done some programming in the past with visual basic and have written a few games using graphics but was always able to get by using .gfi files for transparencies. I admit I am quite new at this modding stuff and alpha business so I apologize for my lack of understanding.

User avatar
Isaac
Posts: 2836
Joined: Fri Mar 02, 2012 10:02 pm

Re: gold coin

Post by Isaac » Sun Mar 22, 2015 2:13 am

RayB wrote:No luck so far. Saved coin as .dds using paint.net but when I pick it up in the dungeon previewer the whole pic is transparent. Don't quite know what I am doing wrong.

As far as the 'key on the floor' problem I didn't really grasp your explanation.

Have done some programming in the past with visual basic and have written a few games using graphics but was always able to get by using .gfi files for transparencies. I admit I am quite new at this modding stuff and alpha business so I apologize for my lack of understanding.
Which game are you using, (LoG1 or LoG2)?

There is a link in my previous post to a working coin template I made for LoG1. Try it in the editor.
*Even for LoG2, the texture files should work just the same.

About the key, the coin definition would seem to list the game's key [fbx] model file, instead of a coin model. To get the key to look like a coin requires a custom model that does not exist in the game. You would have to make one in a 3D modeler, and import it yourself.
*However... I have included a coin model that I have made, in the loG coin template project; and it is made such that it is relatively easy to customize the look of the coin, by altering the supplied texture ~no 3D modeling required. You can use that project as you wish, or alter it to suit your needs in any way you like. ;)

(And of course this goes for anyone else that wants a coin in their mod.)

RayB
Posts: 94
Joined: Fri Mar 06, 2015 3:45 am

Re: gold coin

Post by RayB » Sun Mar 22, 2015 5:28 pm

To answer your question I am working with LoG1.

Got my gold coin pic to work. Used Microsoft Photo Editor & saved as .png - then used a small converter program obtained off the net to convert the file to .dds. As mentioned in my previous post, for some reason paint.net didn't seem to work. I'm sure I had something set wrong.

As far as the key on the floor goes, I will try your gold coin project.

Thank you for your help

RayB
Posts: 94
Joined: Fri Mar 06, 2015 3:45 am

Re: gold coin

Post by RayB » Tue Mar 24, 2015 6:53 pm

I have tried your gold coin model and it works just fine. But I must admit I am really not up to speed on this modeling stuff. I checked out your files and noticed that the only one that looked like your model of a gold coin was the one in the atlas file. To my surprise the diffuseMap and normalMap files looked similar to the gold coin that I drew; that is they looked as though viewing them from directly above. I don’t know why these files showed both the front and back of the coin as only the front is used in the game. The normalMap file (the blue one) looked as though it was some sort of mask. Also, I noticed your script refers to a gold_coin.fbx file but I could not find it. I assume it is somewhere in the gold_coin.model file.

I am trying to create a coin slot to work as a lock and use the coin as a key. I tried an atlas icon and cloned a lock. In the clone script I referred to my coin slot icon in the atlas with the proper index but although, when previewed, it worked using the coin as it was supposed to, it did not show my coin slot icon; just the regular lock (I'm guessing another modeling issue).

Are there any good sites on the net where I can learn more about this modeling stuff? Preferably in layman’s terms!
I know you mentioned Blender but I am afraid without a basic understanding of modeling I would be in over my head.

On a final note, thank you very much for all the help you've given me so far.

User avatar
Isaac
Posts: 2836
Joined: Fri Mar 02, 2012 10:02 pm

Re: gold coin

Post by Isaac » Tue Mar 24, 2015 10:51 pm

Image
RayB wrote:I don’t know why these files showed both the front and back of the coin as only the front is used in the game.
It allows for the coin to be used in ways that could show the flip-side; It could [optionally] be used as a projectile that spins in the air. It could even be used in a socket ~sideways, like a coin slot.
The normalMap file (the blue one) looked as though it was some sort of mask. Also, I noticed your script refers to a gold_coin.fbx file but I could not find it. I assume it is somewhere in the gold_coin.model file.
The normal map might be overkill.
It's optionally omitted from the material definition). Normal maps are color coded information used by the renderer to fake dynamic shadows.

The FBX part is a quirk of the engine. It's that way for historical reasons... The model is in Grimrock's .model format, but it must be referenced in the definition as a .fbx file. It's the same with the images; they are all .dds files, but are referenced as .tga files.
Are there any good sites on the net where I can learn more about this modeling stuff? Preferably in layman’s terms!
I know you mentioned Blender but I am afraid without a basic understanding of modeling I would be in over my head.

The absolute basic concept is that you are describing a [usually] solid shape using polygons; points, lines, and faces.
Points are called vertices, lines are called edges, faces ~faces.
Image

Blender gets updated every few months, so tutorials quickly become dated, but these are fairly recent:
https://www.youtube.com/watch?v=lY6KPrc ... z-bvhKpGkS
It's a place to start.

*Most tutorials are not going to be about designing game assets, but they will familiarize you with the program and its tools.

Here is an intermediate tutorial that I just found, for making a simple treasure chest. [time: 9:50]
https://www.youtube.com/watch?v=L6C4_G2OLEE
This is the basic overview of making a [static] 3D model, suitable for use as a game prop. The finished object would then need to be exported in a common model format (like .obj, or .fbx), and imported into the game ~in this case using the Grimrock Model Toolkit.
Last edited by Isaac on Wed Mar 25, 2015 9:08 am, edited 2 times in total.

minmay
Posts: 2563
Joined: Mon Sep 23, 2013 2:24 am

Re: gold coin

Post by minmay » Tue Mar 24, 2015 11:08 pm

Isaac wrote:
The normalMap file (the blue one) looked as though it was some sort of mask. Also, I noticed your script refers to a gold_coin.fbx file but I could not find it. I assume it is somewhere in the gold_coin.model file.
The normal map might be overkill.
It's optionally omitted from the material definition). Normal maps are color coded information used by the renderer to fake dynamic shadows.
Normal maps are not related to shadows. A normal map is an encoding of surface normal direction. By using a normal map, one triangle can sort of have a gradient of surface normals throughout, instead of just one single normal. Since the intensity of lighting depends on the direction of the surface normal vs. the direction of the light, the result is that you get varied lighting throughout the triangle, which gives the illusion of additional depth without nearly as much overhead as would be need to store and render additional triangles. (Normal maps are typically generated automatically from a very high-polygon model, then used on a lower-polygon version of the same model.)
Normal mapping does not make any actual changes to the geometry so I don't see how you could use it for shadow casting. This is also why normal mapped surfaces start to look flat as the camera or light angle gets closer to being parallel to the surface; you start to notice that the geometry isn't actually there.
http://en.wikipedia.org/wiki/Normal_mapping
http://en.wikipedia.org/wiki/Normal_map ... xample.png
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.

User avatar
Isaac
Posts: 2836
Joined: Fri Mar 02, 2012 10:02 pm

Re: gold coin

Post by Isaac » Tue Mar 24, 2015 11:32 pm

minmay wrote:
Isaac wrote:
The normalMap file (the blue one) looked as though it was some sort of mask. Also, I noticed your script refers to a gold_coin.fbx file but I could not find it. I assume it is somewhere in the gold_coin.model file.
The normal map might be overkill.
It's optionally omitted from the material definition). Normal maps are color coded information used by the renderer to fake dynamic shadows.
Normal maps are not related to shadows. A normal map is an encoding of surface normal direction. By using a normal map, one triangle can sort of have a gradient of surface normals throughout, instead of just one single normal. Since the intensity of lighting depends on the direction of the surface normal vs. the direction of the light, the result is that you get varied lighting throughout the triangle, which gives the illusion of additional depth without nearly as much overhead as would be need to store and render additional triangles.
That is the long winded too-much-information-for-the-novice-that-doesn't-really-care-about-it-yet explanation of it. True. ;)
(Normal maps are typically generated automatically from a very high-polygon model, then used on a lower-polygon version of the same model.) Normal mapping does not make any actual changes to the geometry so I don't see how you could use it for shadow casting.
The upshot being fake shading of virtual detail.
Image
Image

@RayB: A two minute video explanation of NormalMaps.
https://www.youtube.com/watch?v=SQrHkKnSBcA

RayB
Posts: 94
Joined: Fri Mar 06, 2015 3:45 am

Re: gold coin

Post by RayB » Thu Apr 30, 2015 7:57 pm

I have been tinkering around with the sites you recommended and have downloaded blender (a nice program but with a rather steep learning curve for me) and have created a coin slot with it but I don't know how to import it into a Grimrock model file. By the way, what is a Grimrock model file? Is it a picture saved in a certain format? A data file or what? I know you have included a 'gold_coin.model' file in your gold coin file collection but I have no idea what's in it or how to view it; only that you refer to it as gold_coin.fbx (which you have explained). Please excuse my dumbness. I am probably in over my head. If the answers to these questions are too in-depth for a forum discussion just let me know and I will drop it. Also, as I said the gold coin model and files you've created work just great. Thanks for the help. I will keep plugging along.

Post Reply