Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature-Request] Support for normal maps #4

Open
NetroScript opened this issue Nov 5, 2018 · 2 comments
Open

[Feature-Request] Support for normal maps #4

NetroScript opened this issue Nov 5, 2018 · 2 comments

Comments

@NetroScript
Copy link

NetroScript commented Nov 5, 2018

With TexturePacker you have the option to automatically create a normalmap file which has the same positions + regions for the supplied normalmaps as the texture file. But when using this plugin for godot the normal file which can be also generated is completely ignored.

A simple fix for a spritesheet (which I used in my project now) could be f.e. adding

		if sheet.has("normalMap"):
			var normalsheetFile = source_file.get_base_dir()+"/"+sheet.normalMap
			var normalimage = load_image(normalsheetFile, "ImageTexture", [])
			for sprite in sheet.sprites:
				sprite.filename += "_n"
			create_atlas_textures(sheetFolder, sheet, normalimage, r_gen_files)

after this (This code assumes that the file extensions are trimmed, otherwise you would have to change it slighty)

This also creates "empty" normalmaps (if the original spritesheet had no normalmap for a specific texture) instead of no normalmap at all- I don't know if this would be the intended functionality. Additionally it doesn't really leave room for customisation (if the user f.e. wanted a specific folder for all the normal maps).

But it would be nice if this or something similar was added to the import of spritesheets and tilesets

@CodeAndWeb
Copy link
Owner

Nice idea - but I need more time to investigate this.

@2shady4u
Copy link
Contributor

@NetroScript I had to modify the script above somewhat to get this working:

if sheet.has("normalMap"):
	var normalsheetFile = source_file.get_base_dir()+"/"+sheet.normalMap
	var normalimage = load_image(normalsheetFile, "ImageTexture", [])
	for sprite in sheet.sprites:
		var extension = sprite.filename.get_extension()
		var basename = sprite.filename.get_basename()
		sprite.filename="{0}_n.{1}".format([basename, extension])
	create_atlas_textures(sheetFolder, sheet, normalimage, r_gen_files)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants