- Edited
Update to the hair.
Update to the hair.
As part of her story, she is covered in food.
Working on a rough layout for the town level.
The models will be replaced of course.
SuperDoomKing I don't know if it's a comedy touch, but personally I'd take the moustache off
The character is based of an old character I created for a different project. In that project she was meant to be just an npc. I never got far in that project, because at the time I wasn't very used to coding and game design. I do want to restart that project at some point, now that I have more experience. As for the character, I wanted her to be weird and a bit delusional, so I gave her a moustache. Not only unconventional for a girl, but also in the story everyone wears the same "school uniform", wearing something outside the norm would add to her weirdness.
Anyway, I want to go back at some off my older projects / ideas and implement them or reference them in this one. This girl is one of them, removing the moustache would remove the point.
In a way, she is also a reference to mooncity, a 2d platformer I once worked on.
I don't have proper textures made, these are just placeholders.
Also, fun fact: The lantern model was made by a friend of mine, meaning it's the only 3d model, so far, I didn't make.
Right now I only have 3 different buildings, which is too much repetition. I will make at least 2 more, to make it more varied. At least it now gives a nice rough idea how these street will look like with different buildings.
Also I hate it whenever I reimport models that all the textures disappear. Always having to reapply everything is just pure pain.
I should really find a better way switching between godot and blender.
SuperDoomKing Also I hate it whenever I reimport models that all the textures disappear. Always having to reapply everything is just pure pain.
That's unusual. I've reimported my character many times but never have that problem. (I use the default gltf export settings in Blender, the only tick I make is to export only selected object)
On default gltf and other formats export with materials on.
I export my models (usually) without materials. If I export models with materials on, this would not be an issue.
However I like to make the materials and shaders in godot, so it's easier to reuse it for multiple models.
If I exported everything with materials, I would have like 10 different materials with the same brick texture for different models.
While not terrible, having only 1 brick material makes it easier to change the bricks for all models at once.
So the materials aren't really part of the model.
I set the materials under Surface Material Override.
When I reimport the models, it also removes the materials from the Surface Material Override.
A bit annoying, I hope they change it in a future version of Godot.
Adding some objects, like trees and lanterns.
It's starting to look like a real town.
There are still some major flaws, like the fence floating in the air.
For now it's just visual representation of what it may will look like.
SuperDoomKing
You can try setting it up using the code set_surface_override_material(). Place the code in _ready() script somewhere above your imported node and it will do it for you automatically upon loading.
for example:
@onready var bricks = preload("res://bricks.png")
@onready var house_mesh = $House/house_Meshinstance3D #your imported house's mesh
func _ready():
var mat = StandardMaterial3D.new()
mat.albedo_texture = bricks
house_mesh.set_surface_override_material(0,mat)
Then you can apply this code on other house object (eg. house1_mesh = $House1/house_Meshinstance3D) and it will use the same bricks.png. Whatever material settings in the inspector can also be set via code. You can use this method for shader material as well.
Try it on simple cube project first and see if it suitable for your need.
Gowydot
I had thought about such automation before.
I never did it, since I thought the amount of time setting everything up would be a waste just for a mild inconvenience.
Sometimes it's hard to decide if creating automation is worth the effort.
I'll consider doing it, now I have to do a lot more level creation.
Probably a stupid question:
Gowydot Place the code in _ready() script somewhere above your imported node and it will do it for you automatically upon loading.
This code is placed in the script in the game. Is it possible to perform a similar procedure when importing models, because there are import scripts?
`
@tool
extends MeshInstance3D
@onready var placeholder_mat = preload("res://material/normal.tres")
@export var override : Array[StandardMaterial3D]
func _ready():
# For New Models
if override.size() < get_surface_override_material_count():
override.clear()
for i in range(get_surface_override_material_count()):
# Check If Material Exists
if get_surface_override_material(i):
override.append(get_surface_override_material(i))
else:
override.append(placeholder_mat)
# Check If Materials Match
else:
for i in range(get_surface_override_material_count()):
# Replaces Materials With Array Materials
if override[i] != get_surface_override_material(i):
set_surface_override_material(i, override[i])
`
Gowydot
I came up with this. A bit overly complicated maybe, but can be applied to every model, regardless of materials and amount.
@tool
extends MeshInstance3D
@onready var placeholder_mat = preload("res://material/normal.tres")
@export var override : Array[StandardMaterial3D]
func _ready():
var surface_count = get_surface_override_material_count()
var override_size = override.size()
# Check If Materials Match
for i in range(surface_count):
# Replaces Materials With Array Materials
if i < override_size:
if override[i] != get_surface_override_material(i):
set_surface_override_material(i, override[i])
else:
break
# For New Models
if override_size < surface_count:
override.clear()
for i in range(surface_count):
# Check If Material Exists
if get_surface_override_material(i):
override.append(get_surface_override_material(i))
else:
override.append(placeholder_mat)
`
I realized my previous version was very flawed, so I made a small update.
SuperDoomKing
Wow, looks much more advanced than the basic code I got LOL ️
@Tomcat SuperDoomKing
First time I heard of import script so I gave it a test.
I was able to change the color of a simple cube when reimport, using the doc's script.
https://docs.godotengine.org/en/stable/tutorials/assets_pipeline/importing_scenes.html#using-import-scripts-for-automation
@tool
extends EditorScenePostImport
func _post_import(scene):
iterate(scene)
return scene
func iterate(node):
if node != null:
node.name = "modified_" + node.name
var mat = StandardMaterial3D.new()
mat.albedo_color = Color.BLACK
for child in node.get_children():
child.set_surface_override_material(0,mat)
What I did:
-Create This script but don't attach to any node.
-Import a cube without material then give it an inherited scene
-Then select your imported cube.glb > Go to Import > Advance then add the script to the "scene"'s import script box
-Click reimport the cube to see cube's color change from empty white to Color.BLACK.
This could be very handy for your texturings.
Gowydot
I wouldn't call my code advanced, they are just a couple for loops checking every material.
Now that import script is very interesting. I didn't know that was even possible.
After half a decade messing with Godot and there are still so many cool features I am completely unaware of.
I will mess around with it later, this could be a huge game changer.
Don't forget to save the import script everytime after you make any script adjustments. Took me a bit to figure why it wouldn't update the model when reimport (there is nothing on the tab (*) to indicate script has been changed)
Quickly testing some random colours to see how it looks like. However I am very lazy, so I wrote code to randomize the colours for me.
Just some more building variety and it will look nice.
Also this discussion now has more than 100 posts! I consider that a huge achievement. Maybe someday this discussion will be in the top 10.
Gowydot
I tried the import script, however I wasn't able to figure out how to use it for existing materials. I may try again later. However I decided to reimport one of my building models into a gltf file and what I learned is when you save the model als a new inherited scene it will keep the materials even after updating the model. I knew about the inherited scenes, I didn't know they could do that, if only I knew earlier.
I added some new building models, once again I am very lazy so I randomized them.
I also changed so only the front bricks of the models will change their colour randomly.
It' s all about how it looks from the front.
Something that bothered me a lot about this project was the shadow colour.
I think black is a terrible colour to use, especially for a more stylized game like this.
So I made a new shader that will allow me to colour the shadows how I see fit.