Jump to content

[1.2.2] [WIP] INSTANTIATOR - a plugin that allows you to create accretion disks, custom star coronas, nebulas & even more!


Artyomka15

Recommended Posts

21 hours ago, Gameslinx said:

@AndrewDrawsPrettyPictures you could create a 'barycentre' for the nebula, and apply a type "sphere" around it to make it look 3d.

I don't think you understand what I'm asking. My first question is whether there is a way for the dev to make the objects that you add around bodies able to be larger without glitching things out. My second question is whether the dev could add an option to orient the objects to the user's liking instead of them being fixed in one orientation.

Link to comment
Share on other sites

On ‎22‎-‎7‎-‎2017 at 10:55 PM, Gameslinx said:

 

DO NOT apply it to stars.

Well, i think the sun is an exception. I wish i could post and image about that, btu Imgur screwed me up (The disk was REALLY far from the sun and it wasn't glitching or something

Link to comment
Share on other sites

  • 1 month later...
1 hour ago, Galacticvoyager said:

I wonder if this works in 1.3....

Poorly. Don't know why the dev silently sneaks around the forums ("Last Visited: 1 hour ago") without interaction or even just recompiling this for 1.3 and effectively allowing the rest of his mods to function in 1.3.

Link to comment
Share on other sites

13 hours ago, themaster401 said:

Poorly. Don't know why the dev silently sneaks around the forums ("Last Visited: 1 hour ago") without interaction or even just recompiling this for 1.3 and effectively allowing the rest of his mods to function in 1.3.

1. The dev does not have to update his mods. It's not like updating his mods is the one and only thing he has to do.

2. Let's give the dev the time to update the mod, shall we? That we are all eager to play with mods such as INSTANTIATOR does not mean that @Artyomka15 has to push aside everything he wants to do in favor of updating mods, which can feel like a chore at times. Especially comments such as this are excellent at wrecking any coding spirit.

TLDR: please calm down and respect the fact that the dev may take as long as he wants to update a mod. I'm certain the dev has more to do in a day than updating KSP mods. Thank you.

Link to comment
Share on other sites

  • 3 weeks later...

HOLD ON TO YOUR SEATBELTS, KERBALS!

dWAJvqc.png

This is an image I took mere minutes ago, in KSP 1.3

I have decided to update INSTANTIATOR myself in the absence of @Artyomka15, with the following changes:

Spoiler

- Recompiled against KSP 1.3 (ergo 1.3 compatible)

- New config layout:

Old:


SCALED_OBJECT
{
	...
}
SCALED_OBJECT
{
	...
}

New:


INSTANTIATOR
{
	SCALED_OBJECT
	{
		...
	}
	SCALED_OBJECT
	{
		...
	}
}

Future stuff:

- The ability to add INSTANTIATOR objects through ModuleManager

- Original shaders to create highly detailed objects, using soon-to-be-implemented ConfigNodes (SCALED_OBJECT is legacy INSTANTIATOR, these other nodes will offer better control over shaders)

I am going to do some final tests, expect a download link before / during the weekend.

Please know that I am in no way, shape or form claiming ownership of INSTANTIATOR, I am merely trying to keep the mod up-to-date and available to the public because it is such a wonderful and powerful tool, while improving it where possible.

On 9/2/2017 at 10:49 PM, Galacticvoyager said:

I wonder if this works in 1.3....

This weekend, I will release a version of INSTANTIATOR recompiled against 1.3. The legend that is INSTANTIATOR can and will not die! :D

Edited by The White Guardian
Link to comment
Share on other sites

I loved having a disk around the Sun in my OPM game, but I found out after trying to set up a comm-network that the disk blocks the solar panels from being able to get sunlight (although they would be in direct sunlight otherwise), which basically means anything at 0 degree inclination in my case. I have the shader = Unlit/Transparent in mine as well but I guess the game sees it as an object? Could someone help me with this, I really love the way it looks but had to take it out due to this issue.

Link to comment
Share on other sites

9 hours ago, The White Guardian said:

Hmm... let's see if I can add this before this weekend. I expect it to be a simple Vector3 sum, here's hoping I'm not very wrong...

Huh. That's nice :)

Now let's see if this fixes the many, many MFI exceptions when applied around other stars...

Great work :)

Link to comment
Share on other sites

11 hours ago, shoe7ess said:

I loved having a disk around the Sun in my OPM game, but I found out after trying to set up a comm-network that the disk blocks the solar panels from being able to get sunlight (although they would be in direct sunlight otherwise), which basically means anything at 0 degree inclination in my case. I have the shader = Unlit/Transparent in mine as well but I guess the game sees it as an object? Could someone help me with this, I really love the way it looks but had to take it out due to this issue.

Hmm... I suppose KSP's solar panels work through a raycast-like system: KSP attempts to draw a line between the craft and the nearest star; Should this line be uninterrupted, electricity is generated, otherwise the program returns the object causing the interruption. This can be a part, a planet, etc.

Unless I learn how exactly KSP's system for detecting interruptions works and can write a workaround, I doubt I can fix it the 'traditional' way, but worry not, I have a solution.

 

The current way INSTANTIATOR adds objects is through a cube, which is then stretched and flattened immensely. The result is a narrow strip through which light cannot pass. @Artyomka15 probably devised this system to avoid something called 'back face culling'. You see, every rendered object in KSP has a textured side, the front face, and a transparent side, the back face. Default Unity shaders set this back face to transparency. Thus, a cube-based INSTANTIATOR object appears textured on both sides because the outside of the cube is drawn.

 

The method I propose requires a custom shader, one I am currently crafting for INSTANTIATOR. This shader blocks culling of any kind, ergo, both sides of a mesh' normals are drawn. The idea I have can be executed currently but requires two objects, one with inverted normals, but once the shader goes live, modders should be able to use a 'plane' as a base object for an INSTANTIATOR instance.

 

A plane is nothing but a flat square - it is entirely 2D. It has only one face, counts 2 tris and 4 vertices. Because this leaves a plane infinitely small, light blocking of any kind should be minimal. (think of no to less than a meter of light block).

 

Other features I am trying to add to this shader:

- Detail textures: assign a second texture to provide even more detail to the ring, even from up-close

- Emission textures: choose which areas are light-affected and which are not

- Normal maps: add 'fake depth' if you so desire

 

And future INSTANTIATOR features (gonna take some effort to make...):

- Import custom meshes

- Add particles to an object

- Patch through ModuleManager instead of editing Objects.cfg directly

6 hours ago, Gameslinx said:

Huh. That's nice :)

Now let's see if this fixes the many, many MFI exceptions when applied around other stars...

Great work :)

MFI exceptions when adding around other stars? That's something I am not aware of, let's see if I can find the cause.

Link to comment
Share on other sites

Update: the shader is nearing completion, here are the details:

Properties:

Texture: main texture

Texture: normal map

Color: main color

Texture: detail texture

Float: detail intensity

Float: boost

Texture: misc texture

Color: emission color

 

So, what do they do?

Main texture: the main texture for the object

Normal map: the main normal map for the object. The normal map, if added, creates 'light anomalies' to simulate geometry. Ergo: you make it seem like there are dents for example in an object without those dents actually being there

Main color: the main texture is multiplied by this color. This allows you to recolor the texture on the go.

Detail texture: a second texture drawn over the main texture. Use scale and offset to add detail to objects, so that the immersion isn't broken when the camera is close to the object

Detail intensity: this value controls how much the detail is applied, use this to reduce detail effect if necessary. Should be between 0 and 1.

Boost: the r, g, and b values of the main texture are multiplied by this value. Boost can be used to boost the colors should the texture be too dark.

Misc texture: perhaps the most confusing thing here. This texture is broken down into channels: red, green and blue.

The intensity of red in each pixel controls the 'metallic' value

The intensity of green in each pixel controls the shininess

The blue pixels are the most interesting: they control the intensity of the emission. Ergo the more blue a pixel is, the more this part of the object ignores shadows. So to create an unlit texture, enter a fully blue texture.

Emmission color: this color is applied to shadow-ignoring parts, good for adding colored glow effects

How to set up a misc texture?

- Create a grayscale texture for each of the channels - the lightness of the pixel controls how much of the effect of that channel is applied.

- Next, in GIMP, you can use the Curves tool to remove all channels but the one you want. :)

 

I am currently creating a new Config Node for INSTANTIATOR that uses this shader for maximum control.

Link to comment
Share on other sites

1 hour ago, The White Guardian said:

MFI exceptions when adding around other stars? That's something I am not aware of, let's see if I can find the cause.

As you said. Light cannot pass through. MFI tries applying light through the disk because the source is not occluded. Thus when the star is lighting the surface of a planet the log is spammed with errors. Download GPO latest and add an accretion disk to Olu'um. Then in flight view from KSC with Olu'um in view, look at f12 > console.

Link to comment
Share on other sites

On 9/21/2017 at 10:01 AM, The White Guardian said:

Update: the shader is nearing completion, here are the details:

Properties:

Texture: main texture

Texture: normal map

Color: main color

Texture: detail texture

Float: detail intensity

Float: boost

Texture: misc texture

Color: emission color

 

So, what do they do?

Main texture: the main texture for the object

Normal map: the main normal map for the object. The normal map, if added, creates 'light anomalies' to simulate geometry. Ergo: you make it seem like there are dents for example in an object without those dents actually being there

Main color: the main texture is multiplied by this color. This allows you to recolor the texture on the go.

Detail texture: a second texture drawn over the main texture. Use scale and offset to add detail to objects, so that the immersion isn't broken when the camera is close to the object

Detail intensity: this value controls how much the detail is applied, use this to reduce detail effect if necessary. Should be between 0 and 1.

Boost: the r, g, and b values of the main texture are multiplied by this value. Boost can be used to boost the colors should the texture be too dark.

Misc texture: perhaps the most confusing thing here. This texture is broken down into channels: red, green and blue.

The intensity of red in each pixel controls the 'metallic' value

The intensity of green in each pixel controls the shininess

The blue pixels are the most interesting: they control the intensity of the emission. Ergo the more blue a pixel is, the more this part of the object ignores shadows. So to create an unlit texture, enter a fully blue texture.

Emmission color: this color is applied to shadow-ignoring parts, good for adding colored glow effects

How to set up a misc texture?

- Create a grayscale texture for each of the channels - the lightness of the pixel controls how much of the effect of that channel is applied.

- Next, in GIMP, you can use the Curves tool to remove all channels but the one you want. :)

 

I am currently creating a new Config Node for INSTANTIATOR that uses this shader for maximum control.

 Thanks for your help and for explaining how the models in Unity kind of "act". I have done a lot of texture work (especially with KSP), tons of custom MM patching for KSP, working on java workarounds back in my modded minecraft days, but I have never touched modeling (well, I haven't delved deep enough to understand anything beyond creating a couple of objects), especially in Unity. I'm looking forward to your next iteration and appreciate you taking the time to not just answer my post, but explain why it likely occurred. Keep up the awesome work!

Link to comment
Share on other sites

I'm getting close to making @Artyomka15's idea of easily editing all shader settings a reality.

This new config node type allows the user to set up several 'passes', each of these passes editing one shader property. Thus, INSTANTIATOR code may get rather long, but the ability to customize everything will probably be worth it.

Link to comment
Share on other sites

9 hours ago, shoe7ess said:

 Thanks for your help and for explaining how the models in Unity kind of "act". I have done a lot of texture work (especially with KSP), tons of custom MM patching for KSP, working on java workarounds back in my modded minecraft days, but I have never touched modeling (well, I haven't delved deep enough to understand anything beyond creating a couple of objects), especially in Unity. I'm looking forward to your next iteration and appreciate you taking the time to not just answer my post, but explain why it likely occurred. Keep up the awesome work!

You quoted me explaining a custom shader, don't use that info to edit Unity's built-in shaders - the names of the shader properties differ.

For the sake of other people subscribed to this thread, I'll put the following in a spoiler.

Spoiler

Unity works through 'GameObjects'. Lots and lots of GameObjects.

Each of these GameObjects has several 'Components', and each component has it's own function.

Transform component: stores the position, rotation and scale of the GameObject

Renderer component: stores the material settings of the GameObject

etc

 

To model with Unity:

- Firstly, create your model in any 3D program, such as Blender, Maya or 3DSMax. Make sure you unwrap the model and assign a texture, so that the model contains 'UV geometry data', the info that tells Unity how to assign textures

- Next, export in a format that Unity can read (I personally use .obj) and, with Unity open, drag your model into your Assets folder (or in a subfolder of the Assets folder). Unity will automatically import all of the geometry and also create a material assigned to the model.

- To load your model in the scene, either drag the model onto the scene window, or into the Hierarchy window. The model should have several components by default: Transform and Renderer (probably MeshRenderer)

You can then alter the appearance of the model by editing the material assigned to it, or through script. I personally use C# for programming so I don't know how to do this in JScript, but in C#, I write:


//First, we grab the Renderer component attached to the GameObject. For this we use GetComponent<T>();, where T is the type of the component we wish to grab. We store the component in 'r'.
Renderer r = GetComponent<Renderer>();

//Now, we can edit the material in any way we like. Let's alter the main texture of our object

//First, we make a new texture property to assign to the object. We make it public so we can assign a texture in the Inspector window
public Texture newTex;

//Now we use the SetTexture function to alter the texture. SetTexture expects two variables: a string 'propertyName', and the new texture
r.SetTexture("_MainTex", newTex);

//Most built-in Unity shaders have the internal name "_MainTex" for the main texture

I hope this helps. I'm no Unity wizard myself but I'd be happy to teach you everything I know. :D

 

Link to comment
Share on other sites

  • 4 months later...
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

×
×
  • Create New...