fake an outline shader

Posted By: xbox

fake an outline shader - 06/03/14 01:37

I have several simple models (3D primitives for the most part) that I need to have an "outline" on. Basically just lines that connect the outer most vertices together. I have A8 free so shaders are not an option, hence the problem. I am almost 100 percent sure I could just use the draw3dline (sorry, I don't remember the exact function) command to connect the vertices but that will require hard programming the individual vertex numbers in an array in order so I could read them ad connect them. Again it's possible, but it doesn't seem sensible. Any hints or ideas that might be a better approach?
Posted By: Superku

Re: fake an outline shader - 06/03/14 04:06

You can do this in a modeling program: Duplicate your model, scale it a little (by normals, which is not possible in MED), invert the normals and apply a black skin. Now render both entities at the same time and position (you can scale the black model depending on object-camera distance to keep the outline at the same thickness).
Posted By: xbox

Re: fake an outline shader - 06/03/14 19:21

I did this before, only I scaled it using MED which then ran into problems as you said. I just downloaded Blender to try this, imported the model, selected scale and changed to normals, set it to about 1.5 just to see the result, exported it and merged with original model in MED to see the size, and the imported model is half of it's original size. I'm not sure what I'm doing wrong.
Posted By: tolu619

Re: fake an outline shader - 06/03/14 20:23

While we're at this, can anyone post a sample code for how to do that with shaders for those of us using the commercial version?
Posted By: DLively

Re: fake an outline shader - 06/03/14 21:20

^^ You can find what you are looking for in the wiki laugh
Posted By: Superku

Re: fake an outline shader - 06/04/14 03:35

I don't know anything about Blender but try to duplicate the model, scale only the new one and keep the old one as a reference.
Posted By: Ch40zzC0d3r

Re: fake an outline shader - 06/04/14 09:27

I should really work on a plugin (which can be used with LoadLibrary too) so you can use shaders on the free version :S
Posted By: xbox

Re: fake an outline shader - 06/04/14 14:27

@Superku - That's exactly what I'm doing. It seems no matter how big I scale the new inverted one, when I export it from blender and import it back to MED and merge with the original to check sizes, the new one is always about half of the size, even if I scale it to 50 times larger in blender.

@Ch40zzC0d3r - Yeah, you really should. What are you waiting for?? grin hahaha just kidding with you. I'd have no clue where to even begin with that grin
Posted By: Superku

Re: fake an outline shader - 06/04/14 14:29

What I tried so say was the following: Take a cylinder for example. Now create a copy of the object in Blender so you have two cylinders in one file. Try to only scale one of them and keep the other object/ mesh unchanged. That should help.
Posted By: Kartoffel

Re: fake an outline shader - 06/04/14 16:47

@superku, you have to flip normals on the outer one and scale it along the normal afaik
Posted By: Superku

Re: fake an outline shader - 06/04/14 16:56

Yes, that's what I said in my post above:

Originally Posted By: Superku
You can do this in a modeling program: Duplicate your model, scale it a little (by normals, which is not possible in MED), invert the normals and apply a black skin.
Posted By: xbox

Re: fake an outline shader - 06/05/14 00:57

I have done as Superku suggested, but I'm not getting anywhere. I have absolutely no experience with blender, and it's looking to stay that way grin I feel like there is an issue with the importing of obj and 3ds into MED. If I scale along the normal and export as 3ds to import into MED, it imports at half of the size of the original. If i export as obj to import into MED, it imports even smaller at almost a quarter of its original size. In case you are wondering, I'm importing it back into MED because 1) I need to save it as a mdl 2) I can't flip normals in blender.

I really appreciate you guys taking time to offer tips and suggestions. If you want, I'll download HyperCam or similar to record my desktop so you guys can see exactly what i'm doing (if it's something wrong) and see what my problem is. Just let me know.
Posted By: txesmi

Re: fake an outline shader - 06/05/14 08:58

Originally Posted By: xbox
it imports at half of the size of the original.

I'd bet it has something to do with the inch<->cm relation.

Salud!
Posted By: xbox

Re: fake an outline shader - 06/05/14 17:16

Okay, I recorded a video showing exactly what I'm doing, maybe someone can point out something I'm doing wrong??

Thanks again for the help.

[video:youtube]https://www.youtube.com/watch?v=xEdXhYmwwBI&feature=youtu.be[/video]
Posted By: Kartoffel

Re: fake an outline shader - 06/05/14 17:40

I don't have the time to watch the entire video, sorry, but it seems like you scale the model globally: you have to scale every polygon along it's normal, the shortcut is 'alt+s'.

to flip the normals, simply press 'w' and click "flip normals".

at least these are the shortcuts for the blender version I use.
for both, the scaling and flipping the normals, you have to select the whole model.

Edit: well, looks like the video isn't as long as I expected... from what I saw you did everything right, there's just a scale problem when converting the model.
maybe you could try another format like fbx.
Posted By: xbox

Re: fake an outline shader - 06/06/14 21:28

I've tried 3ds, and obj files. Obj comes out even smaller than 3ds. I wanted to try fbx but when I went to import into MED, I discovered no fbx option...when was that taken out??
Posted By: DLively

Re: fake an outline shader - 06/07/14 02:49

It shouldn't be taken out... I import from FBX because I purchased from arteria
Posted By: xbox

Re: fake an outline shader - 06/07/14 06:13

I have MED version 6.922. For as long as I remember there was an fbx import option, but this is what I have
Posted By: Superku

Re: fake an outline shader - 06/07/14 06:32

I have seen/ read this FBX problem multiple times in the past, search for it. I don't know the reason or fix anymore but you could try to re-install Gamestudio.
Posted By: Kartoffel

Re: fake an outline shader - 06/07/14 08:06

there you go
Posted By: xbox

Re: fake an outline shader - 06/07/14 15:00

Huh, didn't know this was an issue. grin I'm downloading Visual C++ 2005 as I speak. I hope this works...

Well, it gave me the ability to import fbx files, however the fbx import is even smaller scale than the others. Upon importing an fbx it allows you to change the scale of the object before it's actually imported, but I don't think it will do it through normals.
Posted By: xbox

Re: fake an outline shader - 06/17/14 00:12

Alright, I scaled the model in Blender by "normals" or so it says, and then exported back to MED as an fbx. When I imported it back into MED, I set the fbx scale to 5.0 and that seems to be a decent size, however it seems like it only scaled globally and not by normals. The shortcuts provided by @Kartoffel don't seem to work. "Alt+S" suddenly makes the model extremely large and the camera cant render the entire thing, and "w" brings up a secondary menu (with the entire object selected) with no option to flip the normals.
I apologize for seemingly being a pain the butt. Something so simple, and I can't figure it out grin
Posted By: Superku

Re: fake an outline shader - 06/17/14 09:29

http://wiki.blender.org/index.php/Doc:2.4/Manual/3D_interaction/Transformations/Basics/Scale
Well this page says that Alt+S in edit mode is the way to go, too. Try harder!
Posted By: Kartoffel

Re: fake an outline shader - 06/17/14 11:25

Maybe you're using an old Blender version in which this feature doesn't exist or uses a different shortcut.
Posted By: xbox

Re: fake an outline shader - 06/17/14 16:02

I'm using 2.7 beta and from what I saw there's little to no documentation for it, just 2.6. Don't worry, I'm gonna keep trying grin
© 2024 lite-C Forums